mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-11 08:34:21 -07:00
portage: command args as list rather than string (#10602)
* portage: command args as list rather than string * add changelog frag * fix pr number in chglog frag
This commit is contained in:
parent
b1bb034b50
commit
a90759d949
2 changed files with 8 additions and 6 deletions
2
changelogs/fragments/10602-portage-cmd-list.yml
Normal file
2
changelogs/fragments/10602-portage-cmd-list.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- portage - using safer mechanism to run external command (https://github.com/ansible-collections/community.general/pull/10602).
|
|
@ -282,7 +282,7 @@ def query_atom(module, atom, action):
|
|||
return bool(exists)
|
||||
|
||||
|
||||
def query_set(module, set, action):
|
||||
def query_set(module, set_, action):
|
||||
system_sets = [
|
||||
'@live-rebuild',
|
||||
'@module-rebuild',
|
||||
|
@ -294,16 +294,16 @@ def query_set(module, set, action):
|
|||
'@x11-module-rebuild',
|
||||
]
|
||||
|
||||
if set in system_sets:
|
||||
if set_ in system_sets:
|
||||
if action == 'unmerge':
|
||||
module.fail_json(msg='set %s cannot be removed' % set)
|
||||
module.fail_json(msg='set %s cannot be removed' % set_)
|
||||
return False
|
||||
|
||||
world_sets_path = '/var/lib/portage/world_sets'
|
||||
if not os.path.exists(world_sets_path):
|
||||
return False
|
||||
|
||||
cmd = 'grep %s %s' % (set, world_sets_path)
|
||||
cmd = ['grep', set_, world_sets_path]
|
||||
|
||||
rc, out, err = module.run_command(cmd)
|
||||
return rc == 0
|
||||
|
@ -315,9 +315,9 @@ def sync_repositories(module, webrsync=False):
|
|||
|
||||
if webrsync:
|
||||
webrsync_path = module.get_bin_path('emerge-webrsync', required=True)
|
||||
cmd = '%s --quiet' % webrsync_path
|
||||
cmd = [webrsync_path, '--quiet']
|
||||
else:
|
||||
cmd = '%s --sync --quiet --ask=n' % module.emerge_path
|
||||
cmd = [module.emerge_path, '--sync', '--quiet', '--ask=n']
|
||||
|
||||
rc, out, err = module.run_command(cmd)
|
||||
if rc != 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue