X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=modules%2Flibjuju%2Fjuju%2Fmachine.py;h=39bfa119195b864e32500f0a8fed49f2d0509f48;hp=a46135cdf2f5df403e3a607f40b0da0c72759084;hb=b2a07f566be558a8b59b8b5dedfe8da5ae1b0132;hpb=b09436613925b2eb334c10f219b743868e4b3fe5 diff --git a/modules/libjuju/juju/machine.py b/modules/libjuju/juju/machine.py index a46135c..39bfa11 100644 --- a/modules/libjuju/juju/machine.py +++ b/modules/libjuju/juju/machine.py @@ -21,7 +21,7 @@ class Machine(model.ModelEntity): if not model.info: await utils.run_with_interrupt(model.get_info(), model._watch_stopping, - model.loop) + loop=model.loop) if model._watch_stopping.is_set(): return if model.info.agent_version < client.Number.from_json('2.2.3'): @@ -50,7 +50,7 @@ class Machine(model.ModelEntity): full_status = await utils.run_with_interrupt(model.get_status(), model._watch_stopping, - model.loop) + loop=model.loop) if model._watch_stopping.is_set(): return @@ -146,7 +146,8 @@ class Machine(model.ModelEntity): :param str destination: Remote destination of transferred files :param str user: Remote username :param bool proxy: Proxy through the Juju API server - :param str scp_opts: Additional options to the `scp` command + :param scp_opts: Additional options to the `scp` command + :type scp_opts: str or list """ if proxy: raise NotImplementedError('proxy option is not implemented') @@ -163,7 +164,8 @@ class Machine(model.ModelEntity): :param str destination: Local destination of transferred files :param str user: Remote username :param bool proxy: Proxy through the Juju API server - :param str scp_opts: Additional options to the `scp` command + :param scp_opts: Additional options to the `scp` command + :type scp_opts: str or list """ if proxy: raise NotImplementedError('proxy option is not implemented') @@ -181,10 +183,10 @@ class Machine(model.ModelEntity): '-i', os.path.expanduser('~/.local/share/juju/ssh/juju_id_rsa'), '-o', 'StrictHostKeyChecking=no', '-q', - '-B', - source, destination + '-B' ] - cmd += scp_opts.split() + cmd.extend(scp_opts.split() if isinstance(scp_opts, str) else scp_opts) + cmd.extend([source, destination]) loop = self.model.loop process = await asyncio.create_subprocess_exec(*cmd, loop=loop) await process.wait()