Bug 40728 - ucr set doesn't set local variable if exists already in another UCR scope
ucr set doesn't set local variable if exists already in another UCR scope
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-2-errata
Assigned To: Jürn Brodersen
Philipp Hahn
:
: 41415 41631 (view as bug list)
Depends on:
Blocks: 40913 41631
  Show dependency treegraph
 
Reported: 2016-02-18 15:47 CET by Florian Best
Modified: 2016-06-22 14:21 CEST (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
proposed patch (941 bytes, patch)
2016-06-21 10:06 CEST, Jürn Brodersen
Details | Diff
test (1.36 KB, text/plain)
2016-06-21 12:29 CEST, Jürn Brodersen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-02-18 15:47:38 CET
UCR variables which are set in LDAP aren't set in base.conf if they get set by a joinscript via variable?value syntax. This might cause problems in unjoinscripts when they get removed again but actually aren't removed. Should we change anything here? Reported in Ticket #2016020821000323.

# ucr set --ldap-policy variable?wert
Create variable
# grep variable /etc/univention/base.conf
# ucr get variable
wert
# ucr set variable?wert
Not updating variable
# ucr unset variable
W: The config registry variable 'variable' does not exist
Comment 1 Florian Best univentionstaff 2016-02-18 15:51:47 CET
Part of the original feedback:
Wenn die Variable also lokal nicht vorhanden ist, aber durch den LDAP-Scope bereits vorgegeben ist, wird sie auch lokal nicht gesetzt. Das könnte vielleicht in manchen Situationen zu Problemen führen, wenn der LDAP-Wert später wieder entfernt wird.

I can't imagine a problem which might be caused by this.
Comment 2 Alexander Kläser univentionstaff 2016-06-02 11:07:17 CEST
(In reply to Florian Best from comment #1)
> ...
> I can't imagine a problem which might be caused by this.

Wrong, c.f. Bug 41415 and Bug 40913 :) .
Comment 3 Alexander Kläser univentionstaff 2016-06-02 11:07:38 CEST
*** Bug 41415 has been marked as a duplicate of this bug. ***
Comment 4 Alexander Kläser univentionstaff 2016-06-02 11:07:49 CEST
*** Bug 40913 has been marked as a duplicate of this bug. ***
Comment 5 Alexander Kläser univentionstaff 2016-06-02 11:09:49 CEST
When this behavior is corrected, base/univention-system-activation/scripts/univention-system-activation needs to be adjusted slightly, e.g., as the dpkg-reconfigure call can be removed.
Comment 6 Alexander Kläser univentionstaff 2016-06-06 13:32:55 CEST
Please also add a test case for this behavior.
Comment 7 Jürn Brodersen univentionstaff 2016-06-21 10:06:28 CEST
Created attachment 7757 [details]
proposed patch

Is it ok to use has_key() here?
Or should I use '$key in ucr._registry[$scope]' directly? Alternatively I could add a scope keyword to the get() function.
Comment 8 Jürn Brodersen univentionstaff 2016-06-21 12:29:56 CEST
Created attachment 7759 [details]
test

Test for conditional set
Comment 9 Jürn Brodersen univentionstaff 2016-06-21 16:37:09 CEST
r70502: Make conditional "ucr set $key?$value" layer dependent
Package: univention-config-registry
Version: 11.0.0-4.498.201606211603

r70504: YAML

Sorry if my description in the yaml file is to long.
Comment 10 Jürn Brodersen univentionstaff 2016-06-21 17:25:59 CEST
*** Bug 41631 has been marked as a duplicate of this bug. ***
Comment 11 Philipp Hahn univentionstaff 2016-06-21 17:26:48 CEST
OK: aptitude install '?source-package(univention-config-registry)~i
OK: zless /usr/share/doc/univention-config-registry/changelog.Debian.gz

FIXED: univention-config-registry.yaml
 r70505 | Bug #40728 ucr: Fix YAML
OK: errata-announce -V --only univention-config-registry.yaml

OK: 
 ucr set --force foo?forced # Create foo
 ucr set --schedule foo?schedule # Create foo
 ucr set --ldap-policy foo?ldap # Create foo
 ucr set foo?default # Create foo
 ucr get foo # forced
 ucr unset --force foo
 ucr get foo # schedule
 ucr unset --schedule foo
 ucr get foo # ldap
 ucr unset --ldap-policy foo
 ucr get foo # default
 ucr unset foo
 ucr get foo #
OK: ucs-test -s ucr -E dangerous
OK: /usr/share/ucs-test/03_ucr/53ucs_set_layer -vvvf


r70507 | Bug #40728 test: Add 03/53ucs_set_layer

Package: ucs-test
Version: 6.0.33-73.1487.201606211721
Branch: ucs_4.1-0
Scope: errata4.1-2
Comment 12 Janek Walkenhorst univentionstaff 2016-06-22 14:21:42 CEST
<http://errata.software-univention.de/ucs/4.1/203.html>