mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Reformat everything.
This commit is contained in:
@@ -42,31 +42,33 @@ display = Display()
|
||||
|
||||
|
||||
class Connection(Jail):
|
||||
""" Local iocage based connections """
|
||||
"""Local iocage based connections"""
|
||||
|
||||
transport = 'community.general.iocage'
|
||||
transport = "community.general.iocage"
|
||||
|
||||
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
||||
self.ioc_jail = play_context.remote_addr
|
||||
|
||||
self.iocage_cmd = Jail._search_executable('iocage')
|
||||
self.iocage_cmd = Jail._search_executable("iocage")
|
||||
|
||||
jail_uuid = self.get_jail_uuid()
|
||||
|
||||
kwargs[Jail.modified_jailname_key] = f'ioc-{jail_uuid}'
|
||||
kwargs[Jail.modified_jailname_key] = f"ioc-{jail_uuid}"
|
||||
|
||||
display.vvv(
|
||||
f"Jail {self.ioc_jail} has been translated to {kwargs[Jail.modified_jailname_key]}",
|
||||
host=kwargs[Jail.modified_jailname_key]
|
||||
host=kwargs[Jail.modified_jailname_key],
|
||||
)
|
||||
|
||||
super().__init__(play_context, new_stdin, *args, **kwargs)
|
||||
|
||||
def get_jail_uuid(self):
|
||||
p = subprocess.Popen([self.iocage_cmd, 'get', 'host_hostuuid', self.ioc_jail],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
p = subprocess.Popen(
|
||||
[self.iocage_cmd, "get", "host_hostuuid", self.ioc_jail],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
|
||||
stdout, stderr = p.communicate()
|
||||
|
||||
@@ -82,4 +84,4 @@ class Connection(Jail):
|
||||
if p.returncode != 0:
|
||||
raise AnsibleError(f"iocage returned an error: {stdout}")
|
||||
|
||||
return stdout.strip('\n')
|
||||
return stdout.strip("\n")
|
||||
|
||||
Reference in New Issue
Block a user