nikipore Posted March 18, 2013 Share Posted March 18, 2013 Mine is broken, too (all but 'com' should yield results with me). I cannot dig into it myself at the moment, gotta leave. Will do it tonight, if the problem is still there, then. ~/Archive/ssh$ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from alfredssh import complete >>> complete('com') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "alfredssh.py", line 122, in complete hosts.update(fetch_ssh_config('~/.ssh/config')) File "alfredssh.py", line 23, in update (hosts, source) = _list TypeError: 'NoneType' object is not iterable >>> complete('mac') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "alfredssh.py", line 122, in complete hosts.update(fetch_ssh_config('~/.ssh/config')) File "alfredssh.py", line 23, in update (hosts, source) = _list TypeError: 'NoneType' object is not iterable >>> complete('net') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "alfredssh.py", line 122, in complete hosts.update(fetch_ssh_config('~/.ssh/config')) File "alfredssh.py", line 23, in update (hosts, source) = _list TypeError: 'NoneType' object is not iterable Link to comment
isometry Posted March 18, 2013 Author Share Posted March 18, 2013 I think I've fixed the problem. I was assuming that you had both ~/.ssh/config and ~/.ssh/known_hosts. The workflow barfed if either was missing; now it doesn't. Link to comment
nikipore Posted March 18, 2013 Share Posted March 18, 2013 Fixed it. You weren't testing for non-existing files (I don't have an ssh_config). Couldn't resist to clean up your Linter warnings. Hope I didn't break anything. Thanks for your contribution to python-alfred! http://d.pr/f/jBYw Link to comment
isometry Posted March 18, 2013 Author Share Posted March 18, 2013 Fixed it. You weren't testing for non-existing files (I don't have an ssh_config). Couldn't resist to clean up your Linter warnings. Hope I didn't break anything. Thanks for your contribution to python-alfred! http://d.pr/f/jBYw Thanks, nikipore. I'd already fixed the issue via another means, but your fix is cleaner. I've integrated your tweaks, and download links/GitHub are updated. Link to comment
danson Posted March 19, 2013 Share Posted March 19, 2013 Hiya.. I've got a fairly horrible .ssh/config, and no ssh_config... but it no work for me... ah, seems to be an extra 'z' on line 70: return (results, alias)z Removing that improved things. Link to comment
isometry Posted March 19, 2013 Author Share Posted March 19, 2013 Hiya.. I've got a fairly horrible .ssh/config, and no ssh_config... but it no work for me... ah, seems to be an extra 'z' on line 70: return (results, alias)z Removing that improved things. Oops. Not sure how that one slipped through. Download and source now fixed. Link to comment
ryanneufeld Posted March 20, 2013 Share Posted March 20, 2013 I'm trying to use this with iTerm and zsh. I've set iTerm to be the default ssh:// handler, but for some reason all it's doing is opening a new terminal tab. Anyone have any ideas? Link to comment
isometry Posted March 20, 2013 Author Share Posted March 20, 2013 I'm trying to use this with iTerm and zsh. I've set iTerm to be the default ssh:// handler, but for some reason all it's doing is opening a new terminal tab. Anyone have any ideas? Your iTerm ssh: handling Profile needs to specify the Command as ssh $$HOST$$ (prefix ssh with the appropriate path if you've installed a new version through MacPorts/homebrew/fink). zsh shouldn't come into it. See post #8 in this thread. Link to comment
blysik Posted March 20, 2013 Share Posted March 20, 2013 Any way to get it to open in a tab in the existing terminal? Link to comment
isometry Posted March 21, 2013 Author Share Posted March 21, 2013 Any way to get it to open in a tab in the existing terminal? iTerm2 will do this by default, but I'm not aware of a way to get Terminal.app to do this. iTerm2 also has the advantage that it can be made to set the tab title properly (see post #8). Link to comment
hzlzh Posted March 24, 2013 Share Posted March 24, 2013 Nice work, I've add this workflow on the List: http://www.alfredworkflow.com/ Link to comment
rice.shawn Posted March 26, 2013 Share Posted March 26, 2013 I didn't realize how to do PubKeys at first, and I almost submitted a support request right here, but, instead, I googled ssh config files... So, for those of you who want some help with those, read on here: http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/. And, make sure you put the file at ~/.ssh/config Link to comment
jonathanwiesel Posted April 1, 2013 Share Posted April 1, 2013 Great extension. Works like a charm. Any chance to make it work with the "-i" argument? To ssh to those servers that need the private key file to access. That would be awesome Link to comment
isometry Posted April 1, 2013 Author Share Posted April 1, 2013 Great extension. Works like a charm. Any chance to make it work with the "-i" argument? To ssh to those servers that need the private key file to access. That would be awesome Use ~/.ssh/config (man ssh_config) to specify the private key to be used without having to type it every time. Robin Link to comment
kopischke Posted April 1, 2013 Share Posted April 1, 2013 (edited) http://apple.stackexchange.com/questions/28938/set-iterm2-as-the-ssh-url-handler Ha, so that is what has been driving traffic to this old answer of mine lately? Well, thanks for the upvotes, folks . Edited April 1, 2013 by kopischke Link to comment
firesofmay Posted July 13, 2013 Share Posted July 13, 2013 Really useful workflow. Thanks for sharing! Link to comment
isometry Posted August 12, 2013 Author Share Posted August 12, 2013 Amended reply #8 to resolve a bug with the suggested iTerm2 configuration in which a username, if specified, would be ignored by the iTerm2 ssh:// handler. Link to comment
El Alemaño Posted January 28, 2014 Share Posted January 28, 2014 (edited) Hi, I am using your Workflow with iTerm2 and zsh, and is not working. I am sorry but i don´t understand how the settings should look like. Will be great if you could help me. Here is a screenshot from my iTerm2 Profile Settings [http://screencast.com/t/GAjTiIxyjVO] Thanks. Edited January 28, 2014 by El Alemaño Link to comment
isometry Posted January 28, 2014 Author Share Posted January 28, 2014 I am using your Workflow with iTerm2 and zsh, and is not working. I am sorry but i don´t understand how the settings should look like. Will be great if you could help me. Here is a screenshot from my iTerm2 Profile Settings [http://screencast.com/t/GAjTiIxyjVO] Refer to the instructions earlier in the thread for instructions on how to configure iTerm2. Link to comment
El Alemaño Posted January 29, 2014 Share Posted January 29, 2014 Refer to the instructions earlier in the thread for instructions on how to configure iTerm2. Ok, I already read it, but is not working for me... I don´t know how to use it. I am using zsh and not bash... can you take a look to my iTerm2 Profile Settings Screenshot http://screencast.com/t/GAjTiIxyjVO. Thanks Link to comment
mAAdhaTTah Posted August 6, 2014 Share Posted August 6, 2014 This workflow isn't working for me, and I think it's because my config file is symlinked to Dropbox. When I type in `ssh` and start writing a hostname, it says "please wait" or whathaveyou for a split second before dropping me back to the standard Google prompt. Could the symlink be the issue? Link to comment
isometry Posted August 6, 2014 Author Share Posted August 6, 2014 This workflow isn't working for me, and I think it's because my config file is symlinked to Dropbox. When I type in `ssh` and start writing a hostname, it says "please wait" or whathaveyou for a split second before dropping me back to the standard Google prompt. Could the symlink be the issue? This is odd. Even if you just type "ssh randomhost" it should offer to "Connect to ssh://randomhost (source: input)". That your .ssh/ssh_config is a symlink, or on Dropbox should make no difference whatsoever. Can you provide any more detail? Link to comment
mAAdhaTTah Posted August 6, 2014 Share Posted August 6, 2014 This is odd. Even if you just type "ssh randomhost" it should offer to "Connect to ssh://randomhost (source: input)". That your .ssh/ssh_config is a symlink, or on Dropbox should make no difference whatsoever. Can you provide any more detail? Errr, I would, but I don't get any other errors or anything. I downloaded it from Packal, if that makes any difference. Anything in particular I can do to help debug? Link to comment
isometry Posted August 6, 2014 Author Share Posted August 6, 2014 Errr, I would, but I don't get any other errors or anything. I downloaded it from Packal, if that makes any difference. Anything in particular I can do to help debug? Given you're using this workflow, I'll assume you're happy at the command line :-) Change to the workflow's directory in Alfred preferences (found by right clicking on the Workflow and choosing "Show in Finder", if necessary), and run a query manually: % (Pythagoras:~/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.E2B2A958-21D2-42ED-B6DF-06AF15C6A201) /usr/bin/python -c 'import alfredssh; print alfredssh.complete("local");' <items><item arg="local" autocomplete="local" uid="ssh://local"><title>ssh://local</title><subtitle>Connect to ssh://local (source: input)</subtitle><icon>icon.png</icon></item><item arg="localhost" autocomplete="localhost" uid="ssh://localhost"><title>ssh://localhost</title><subtitle>Connect to ssh://localhost (source: /etc/hosts)</subtitle><icon>icon.png</icon></item><item arg="monster.local" autocomplete="monster.local" uid="ssh://monster.local"><title>ssh://monster.local</title><subtitle>Connect to ssh://monster.local (source: ~/.ssh/known_hosts)</subtitle><icon>icon.png</icon></item></items> The output shows the workflow offering to open ssh://local (from the input provided), ssh://localhost (from /etc/hosts), ssh://monster.local (from ~/.ssh/known_hosts) when triggered with the equivalent of "ssh local" in Alfred. If the above returns an empty list as opposed to an error or a valid list, then try running the function which parses ~/.ssh/config (which I assume is the config file you say is symlinked): % (Pythagoras:~/Dropbox/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.E2B2A958-21D2-42ED-B6DF-06AF15C6A201) /usr/bin/python -c 'import alfredssh; print alfredssh.fetch_ssh_config("~/.ssh/config");' ([u'host.example.com', u'monster'], '~/.ssh/ssh_config') You should get an entry for every non-wildcard entry in your ~/.ssh/config file (host lines which include any of *, ? or ! are excluded). NB: yes, there's currently an inconsistency. For some reason I chose to display entries from ~/.ssh/config as coming from ~/.ssh/ssh_config. Fix forthcoming. Link to comment
mAAdhaTTah Posted August 6, 2014 Share Posted August 6, 2014 user.workflow.3ACC632C-5489-45C1-92AA-6FC07DC4B472 yossarian$ python -c 'import alfredssh; print alfredssh.complete("local");' Traceback (most recent call last): File "<string>", line 1, in <module> File "alfredssh.py", line 137, in complete fetch_known_hosts('~/.ssh/known_hosts'), File "alfredssh.py", line 83, in fetch_known_hosts results.update(line.split()[0].split(',')) IndexError: list index out of range ^^ First command - fwiw, my python version when running that command is 2.7.8. The /usr/bin version is 2.7.5 and gives me the same output. user.workflow.3ACC632C-5489-45C1-92AA-6FC07DC4B472 yossarian$ python -c 'import alfredssh; print alfredssh.fetch_ssh_config("~/.ssh/config");' ([u'pianosa.sytes.net', u'pianosa.sytes.net/deluge', u'LiquidWeb', u'Pianosa/dreedle', u'DigitalOcean/palermo', u'DigitalOcean/napoli', u'Pianosa/crashplan'], '~/.ssh/ssh_config') ^^ Second command. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now