Bug 35341 - changing a room settings affect ucr variables, causing other room settings (behavior, not displayed values) to be changed.
Summary: changing a room settings affect ucr variables, causing other room settings (b...
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: UMC - Computer room
Version: UCS@school 3.2 R2
Hardware: Other Linux
: P5 normal
Target Milestone: UCS@school 3.2 R2 Errata
Assignee: Florian Best
QA Contact: Sönke Schwardt-Krummrich
URL:
Keywords:
Depends on:
Blocks: 35151
  Show dependency treegraph
 
Reported: 2014-07-11 12:35 CEST by Ammar Najjar
Modified: 2014-12-01 12:07 CET (History)
2 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):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ammar Najjar univentionstaff 2014-07-11 12:35:16 CEST
if two computerrooms exist:
room1 <201.132.40.69>
room2 <104.231.177.78>
Changing room2 settings affects the ucr variables related, and thus the behavior of the settings in room1 changes accordingly. Meanwhile the displayed values (computerroom/settings/get) remains the same correct ones.

Example:

Settign room1 to be:
room1 (InternetRule,PrintMode,ShareMode) = ( 'none' , 'none' , 'home' )

~#ucr search printmode; echo; cat /etc/samba/local.config.d/printer.* 

cups/printmode/hosts/none: 201.132.40.69
samba/printmode/hosts/none: 201.132.40.69
samba/printmode/room/boyw8e4d1v: none

[5fabc8mxgm]
hosts deny = 201.132.40.69
[8it2rkfy92]
hosts deny = 201.132.40.69
[PDFDrucker]
hosts deny = 201.132.40.69
[fo5c693c2u]
hosts deny = 201.132.40.69
[r7gcrwnlgf]
hosts deny = 201.132.40.69

Then setting room2 to be:
room2  (InternetRule,PrintMode,ShareMode) = ('none', 'default', 'home') 

~#ucr search printmode; echo; cat /etc/samba/local.config.d/printer.*

cups/printmode/hosts/none: 201.132.40.69
samba/printmode/hosts/none: ""
samba/printmode/room/boyw8e4d1v: none

[5fabc8mxgm]
hosts deny = ""
[8it2rkfy92]
hosts deny = ""
[PDFDrucker]
hosts deny = ""
[fo5c693c2u]
hosts deny = ""
[r7gcrwnlgf]
hosts deny = ""
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2014-07-11 13:42:06 CEST
The following patch fixed the problem within the test environment. It has to be checked if the hotfix has any sideeffects.

--- a/ucs-school-3.2r2/ucs-school-umc-computerroom/umc/python/computerroom/__init__.py
+++ b/ucs-school-3.2r2/ucs-school-umc-computerroom/umc/python/computerroom/__init__.py
@@ -770,7 +770,9 @@ class Instance(SchoolBaseModule):
 		# are unable to print on samba shares. Solution: set empty value for .../none if no host is on deny list.
 		varname = 'samba/printmode/hosts/none'
 		if not varname in vset:
-			vset[varname] = '""'
+			ucr.load()
+			if not ucr.get('varname'):
+				vset[varname] = '""'
 		else:
 			# remove empty items ('""') in list
 			vset[varname] = ' '.join([x for x in vset[varname].split(' ') if not x == '""'])
Comment 2 Florian Best univentionstaff 2014-08-19 11:46:50 CEST
fixed by using a fixed version of that patch from comment 1.

"ucr search printmode; echo; cat /etc/samba/local.config.d/printer.* " now shows the correctly merged values.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2014-08-21 18:19:01 CEST
(In reply to Florian Best from comment #2)
> fixed by using a fixed version of that patch from comment 1.
> 
> "ucr search printmode; echo; cat /etc/samba/local.config.d/printer.* " now
> shows the correctly merged values.

Is seems to be more complicated. Please have a look at
https://forge.univention.org/bugzilla/show_bug.cgi?id=30450#c3:

There are situations where the merging does not work. Tested with 2 rooms with 2 hosts each.

Test 1) in both rooms is printing explicitly enabled
samba/printmode/hosts/all: 192.168.0.58 10.200.18.201 10.200.18.13 10.200.18.202
samba/printmode/hosts/none: ""
samba/printmode/room/DerRaum: all
samba/printmode/room/EinRaum: all
→ OK

Test 2) switch from Test 1) to first room "enabled" and second room "default":
samba/printmode/hosts/all: 192.168.0.58 10.200.18.13
samba/printmode/hosts/none: ""
samba/printmode/room/DerRaum: all
→ OK

Test 3) switch from Test 2) to first room "enabled" and second room "disabled":
samba/printmode/hosts/all: 192.168.0.58 10.200.18.13
samba/printmode/hosts/none: 10.200.18.201 10.200.18.202
samba/printmode/room/DerRaum: all
samba/printmode/room/EinRaum: none
→ OK

Test 4) switch from Test 3) to first room "enabled" and second room "default":
samba/printmode/hosts/all: 192.168.0.58 10.200.18.13
samba/printmode/room/DerRaum: all
→ FAIL
→ should show same result as in Test 2)
→ 'samba/printmode/hosts/none: ""' is missing

Test 5) switch from Test 4) to both rooms "default":
→ no UCR variables set
→ OK

Test 6) switch from Test 5) to first room "disabled" and second room "default":
samba/printmode/hosts/none: 192.168.0.58 10.200.18.13
samba/printmode/room/DerRaum: none
→ FAIL
→ 'samba/printmode/hosts/all: ""' is missing

Test 7) switch from Test 6) to first room "disabled" and second room "disabled":
samba/printmode/hosts/none: 192.168.0.58 10.200.18.201 10.200.18.13 10.200.18.202
samba/printmode/room/DerRaum: none
samba/printmode/room/EinRaum: none
→ FAIL
→ 'samba/printmode/hosts/all: ""' is missing

Test 8) switch from Test 7) to first room "disabled" and second room "default":
samba/printmode/hosts/none: 192.168.0.58 10.200.18.13
samba/printmode/room/DerRaum: none
→ FAIL
→ same result as in Test 6)
→ 'samba/printmode/hosts/all: ""' is missing

Test 9) switch from Test 8) to first room "disabled" and second room "enabled":
samba/printmode/hosts/all: 10.200.18.201 10.200.18.202
samba/printmode/hosts/none: 192.168.0.58 10.200.18.13
samba/printmode/room/DerRaum: none
samba/printmode/room/EinRaum: all
→ OK


Added ucs-test script 22_computerroom_test_printmode_ucr_variables
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2014-08-22 09:47:20 CEST
(In reply to Sönke Schwardt-Krummrich from comment #3)
> Added ucs-test script 22_computerroom_test_printmode_ucr_variables

samba/printmode/hosts/all does not have to be set if only …/hosts/none is set.
So all results from above are correct. I changed the test script accordingly and added tests for 3 rooms testing all possible combinations.
→ back to RESOLVED
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2014-08-22 10:25:39 CEST
OK: Changelog
OK: code change
OK: functionality
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2014-08-27 17:01:38 CEST
UCS@school 3.2 R2 v2 has been released:
http://docs.univention.de/release-notes-ucsschool-3.2R2v2-de.html

If this error occurs again, please use "Clone This Bug".