mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
allow apt-key module to work with binary key
This commit is contained in:
parent
edb6a683f3
commit
94e66ef558
2 changed files with 4 additions and 3 deletions
|
@ -859,7 +859,7 @@ class AnsibleModule(object):
|
|||
self.cleanup(tmp_dest)
|
||||
self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e))
|
||||
|
||||
def run_command(self, args, check_rc=False, close_fds=False, executable=None, data=None):
|
||||
def run_command(self, args, check_rc=False, close_fds=False, executable=None, data=None, binary_data=False):
|
||||
'''
|
||||
Execute a command, returns rc, stdout, and stderr.
|
||||
args is the command to run
|
||||
|
@ -895,6 +895,7 @@ class AnsibleModule(object):
|
|||
stderr=subprocess.PIPE)
|
||||
if data:
|
||||
cmd.stdin.write(data)
|
||||
if not binary_data:
|
||||
cmd.stdin.write('\\n')
|
||||
out, err = cmd.communicate()
|
||||
rc = cmd.returncode
|
||||
|
|
|
@ -112,7 +112,7 @@ def download_key(module, url):
|
|||
|
||||
def add_key(module, key):
|
||||
cmd = "apt-key add -"
|
||||
(rc, out, err) = module.run_command(cmd, data=key, check_rc=True)
|
||||
(rc, out, err) = module.run_command(cmd, data=key, check_rc=True, binary_data=True)
|
||||
return True
|
||||
|
||||
def remove_key(module, key_id):
|
||||
|
|
Loading…
Reference in a new issue