Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #51 #3

Merged
merged 1 commit into from
Mar 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions connmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,28 +625,14 @@ def a_host(line):
lines = [line.strip() for line in file(SSH_CONFIG_FILE)]
comments_removed = [remove_comment(line) for line in lines]
blanks_removed = [line for line in comments_removed if line]
non_hosts_removed = [line for line in blanks_removed if a_host(line)]

block = itertools.groupby(blanks_removed, not_a_host)

first_block = False
for key, group in block:
Info = dict([line.split(None, 1) for line in group])

if (not key):
if (not first_block):
first_block = True
importedHost = Info['Host']
if (key and first_block):
if 'HostName' in Info:
importedHostname = Info['HostName']
if 'User' in Info:
importedHostname = Info['User']+'@'+importedHostname
if 'Port' in Info:
importedHostname = '-p '+Info['Port']+' '+importedHostname

for line in non_hosts_removed:
importedHosts = line.split(None)[1:]
for importedHost in importedHosts:
if importedHost != '*':
treestore.append(import_iter, ['__item__',
importedHost, importedHostname, 'Unnamed', 'ssh'])
importedHost, importedHost, 'Unnamed', 'ssh'])

def is_folder(self, iter):
if self.treestore.get_value(iter, 0) == '__folder__':
Expand Down