mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
lint and fix polkit examples (#8381)
* lint and fix polkit examples Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com> * add changelog fragment Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com> * remove changelog fragment Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com> --------- Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
parent
03240ad7dc
commit
f82e7a7b83
2 changed files with 13 additions and 12 deletions
|
@ -78,12 +78,13 @@ DOCUMENTATION = '''
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
# A polkit rule needed to use the module with a non-root user.
|
# A polkit rule needed to use the module with a non-root user.
|
||||||
# See the Notes section for details.
|
# See the Notes section for details.
|
||||||
60-machinectl-fast-user-auth.rules: |
|
/etc/polkit-1/rules.d/60-machinectl-fast-user-auth.rules: |
|
||||||
polkit.addRule(function(action, subject) {
|
polkit.addRule(function(action, subject) {
|
||||||
if(action.id == "org.freedesktop.machine1.host-shell" && subject.isInGroup("wheel")) {
|
if(action.id == "org.freedesktop.machine1.host-shell" &&
|
||||||
return polkit.Result.AUTH_SELF_KEEP;
|
subject.isInGroup("wheel")) {
|
||||||
}
|
return polkit.Result.AUTH_SELF_KEEP;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from re import compile as re_compile
|
from re import compile as re_compile
|
||||||
|
|
|
@ -69,13 +69,13 @@ EXAMPLES = r"""
|
||||||
# An example polkit rule that allows the user 'ansible' in the 'wheel' group
|
# An example polkit rule that allows the user 'ansible' in the 'wheel' group
|
||||||
# to execute commands using run0 without authentication.
|
# to execute commands using run0 without authentication.
|
||||||
/etc/polkit-1/rules.d/60-run0-fast-user-auth.rules: |
|
/etc/polkit-1/rules.d/60-run0-fast-user-auth.rules: |
|
||||||
polkit.addRule(function(action, subject) {
|
polkit.addRule(function(action, subject) {
|
||||||
if(action.id == "org.freedesktop.systemd1.manage-units" &&
|
if(action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||||
subject.isInGroup("wheel")
|
subject.isInGroup("wheel") &&
|
||||||
subject.user == "ansible") {
|
subject.user == "ansible") {
|
||||||
return polkit.Result.YES;
|
return polkit.Result.YES;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from re import compile as re_compile
|
from re import compile as re_compile
|
||||||
|
|
Loading…
Reference in a new issue