Add SSHConfig method returning hostnames defined in SSH config #167

Merged
merged 1 commit into from Sep 19, 2014

Projects

None yet

4 participants

@kwi-dk
Contributor
kwi-dk commented May 13, 2013

For my application, I need to distinguish between explicit host configuration entries and configuration entries synthesized from wildcard entries (e.g. '*'), something which is not possibly using SSHConfig.lookup().

I figure I might not be the only one, hence the pull request. Unit test is included.

Best regards,
Søren Løvborg

@lndbrg
Contributor
lndbrg commented Aug 14, 2014

Why not! I'm +1 on this.

@kwi-dk
Contributor
kwi-dk commented Sep 11, 2014

Sorry for the delay, I had completely forgottten about this. It's been a while. :)

I actually no longer need this feature; considering that nobody else spoke up for 16 months, I wonder if it'll just end up collecting dust... thoughts? If there's still interest, I'll look into rebasing the pull request against latest master.

@bitprophet
Member

I think it sounds useful enough, and it's tiny & additive (doesn't mutate existing code) so if you have the inclination, by all means.

I'm keeping my head (barely) above water on incoming Github notifications now, so if you post an update (may need to comment - don't think new commits trigger) I should see it and be able to pull it in.

@lndbrg lndbrg and 1 other commented on an outdated diff Sep 17, 2014
paramiko/config.py
@@ -254,3 +254,12 @@ def _expand_variables(self, config, hostname):
else:
config[k] = config[k].replace(find, str(replace))
return config
+
+ def get_hostnames(self):
@lndbrg
lndbrg Sep 17, 2014 Contributor

Could be written as such with a set comprehension:

return {entry['host'] for entry in self._config}
@bitprophet
bitprophet Sep 19, 2014 Member

That's Python 2.7 only unfortunately :)

@kwi-dk
Contributor
kwi-dk commented Sep 19, 2014

I've rebased against latest master. The Travis CI build succeeded for all Python versions except 3.3, where it timed out after 13 minutes. I doubt that it was my code that caused that, though I don't have a Python 3.3 installation readily accessible to check... :-)

@lndbrg
Contributor
lndbrg commented Sep 19, 2014

Will retrigger.

@coveralls

Coverage Status

Coverage decreased (-0.36%) when pulling 8e2d432 on kwi-dk:master into 5b83284 on paramiko:master.

@bitprophet bitprophet added this to the 2.0 milestone Sep 19, 2014
@bitprophet bitprophet merged commit 8e2d432 into paramiko:master Sep 19, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@bitprophet bitprophet added a commit that referenced this pull request Sep 19, 2014
@bitprophet bitprophet Changelog re #167 84995f9
@bitprophet bitprophet removed this from the 2.0 milestone Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment