python3/usb_scan: Read policy rules from drop-in directory - #7253
Conversation
d9aa4ef to
3450ee5
Compare
00f0c45 to
63b619f
Compare
63b619f to
e27a62a
Compare
/etc/xensource/usb-policy.conf is owned by the RPM manager. A customer who edits it to allow/deny some USB devices loses their changes on the next RPM uprade. usb_scan.py now also reads any *.conf files found in /etc/xensource/usb-policy.conf.d, in alphabetical order before it reads the main policy file. Since the first match wins the user rule always override the main file rule. If the drop-in dir doesn't exist, behaviour is unchanged. Tracking-reference: XCPNG-2952 Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@vates.tech>
last-genius
left a comment
There was a problem hiding this comment.
This PR will also require changes to the specfile, could you provide an exact diff for them?
I think it should at least require lines like
%install
...
mkdir $RPM_BUILD_ROOT/etc/xapi.conf.d
%files
...
%dir /etc/xapi.conf.d
but it should be tested
what is this doing? You mean that by default if we don't do anything then "/etc/xensource/usb-policy.conf.d" is not preserved. You need to explicitly modify the RPMs ? |
|
But at least I can test an upgrade and check if it is preserved or not this part is easy :) |
no, it's just that the directory won't exist by default. we usually pre-create these directories for users |
|
Oh ok got it. I will do that. |
|
Are you thinking about something like xcp-ng-rpms/xapi@9383181 ? |
/etc/xensource/usb-policy.conf is owned by the RPM manager. A customer who edits it to allow/deny some USB devices loses their changes on the next RPM uprade.
usb_scan.py now also reads any *.conf files found in /etc/xensource/usb-policy.conf.d, in alphabetical order before it reads the main policy file. Since the first match wins the user rule always override the main file rule. If the drop-in dir doesn't exist, behaviour is unchanged.
Tracking-reference: XCPNG-2952