On 2015-07-13 09:46 AM, Martin Packman wrote:
> Review: Approve
>
> Looks fine.
>
> The next step however, if we want to add more ssh configuration,
> should be just having a dedicated ssh config dir for the
> SSHConnection object, rather than giving everything as command line
> options. That gives use true isolation from the user's ssh config
> and we can be precise about what elements we want to preserve.
I'm not sure I agree. It's nice that the overrides appear in log
messages, and it would be a pain deciding what to preserve and what to
override.
>> + options = list(chain(*[['-o', o] for o in
>> config_options]))
>
> Heh, and you complained about me using map()? :)
>
> You can just do this:
>
> options = ["-o" + o for f in config_options]
>
> The ssh command line parser is fine with that.
In this specific case, where ['-ofoo'] is equivalent to ['-o', 'foo'],
sure. In general, list(chain(*my_lists)) is the least obscure way I
can find of generating a single large list containing all the elements
of a list of lists.
>> if self.private_key is not None: options.extend(['-i',
>> self.private_key]) return options @@ -190,8 +204,11 @@ except
>> Exception as e: logging.exception(e) sys.exit(1) +
>> finally: + primitives.destroy() finally: -
>> primitives.destroy() + connection.known_hosts = None
>
> Unsetting the known_hosts attribute is a little unpleasant. Would
> prefer if SSHConnection just had responsibility for the file.
Maybe in the abstract, but it's a public attribute, so there's nothing
actually wrong with setting/unsetting it. I didn't think it was worth
writing another context manager (e.g. SSHConnection.known_hosts) and
having another layer of indirection just to manage the known hosts file.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2015-07-13 09:46 AM, Martin Packman wrote:
> Review: Approve
>
> Looks fine.
>
> The next step however, if we want to add more ssh configuration,
> should be just having a dedicated ssh config dir for the
> SSHConnection object, rather than giving everything as command line
> options. That gives use true isolation from the user's ssh config
> and we can be precise about what elements we want to preserve.
I'm not sure I agree. It's nice that the overrides appear in log
messages, and it would be a pain deciding what to preserve and what to
override.
>> + options = list(chain(*[['-o', o] for o in
>> config_options]))
>
> Heh, and you complained about me using map()? :)
>
> You can just do this:
>
> options = ["-o" + o for f in config_options]
>
> The ssh command line parser is fine with that.
In this specific case, where ['-ofoo'] is equivalent to ['-o', 'foo'], *my_lists) ) is the least obscure way I
sure. In general, list(chain(
can find of generating a single large list containing all the elements
of a list of lists.
>> if self.private_key is not None: options. extend( ['-i', exception( e) sys.exit(1) + destroy( ) finally: - destroy( ) + connection. known_hosts = None
>> self.private_key]) return options @@ -190,8 +204,11 @@ except
>> Exception as e: logging.
>> finally: + primitives.
>> primitives.
>
> Unsetting the known_hosts attribute is a little unpleasant. Would
> prefer if SSHConnection just had responsibility for the file.
Maybe in the abstract, but it's a public attribute, so there's nothing known_hosts) and
actually wrong with setting/unsetting it. I didn't think it was worth
writing another context manager (e.g. SSHConnection.
having another layer of indirection just to manage the known hosts file.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJ Vo8U+AAoJEK84cM Ocf+9h1x0IALQpJ 8dc9iuTA9fMgMs8 aSux X+eXIJnES6+ TCwO+vcjlenNAVE mD/ovw3rpEh6PDO dJCvksqf 985wOCIae71iF+ Qi4ogucAoKZTzxO wND3RPzUqkZ5Fe/ NAxB/t3c EQUsz7UBUugo7pR QED6BVqxzE72xRw NSBWxjPMUkyljrW QzxC Fj6PZaTQ1V0f+ ZeUMKhlNl/ qXbsZaumme13rZR hMVJVa5UlXm 9ACA0S/ 8ahKniHg9u9piIt eFhc4ppyr3G2Z2L zpNA7xjXRUs=
qHxNKc5BHmFzNPr
JDEc273NtXA+
uJfacxjTvM6JL8K
3R2PgPbC4LuuNqd
5yKZq8tOf812BlG
=TbsU
-----END PGP SIGNATURE-----