Skip to content

Instantly share code, notes, and snippets.

@cocoy
Created January 25, 2011 08:53
Show Gist options
  • Save cocoy/794683 to your computer and use it in GitHub Desktop.
Save cocoy/794683 to your computer and use it in GitHub Desktop.
patch to ssh keypair for littlechef
--- a/littlechef.py
+++ b/littlechef.py
@@ -49,6 +49,7 @@ def new_deployment():
print >>authfh, "[userinfo]"
print >>authfh, "user = "
print >>authfh, "password = "
+ print >>authfh, "keypair-file = "
print "auth.cfg file created..."
@hosts('setup')
@@ -219,9 +220,14 @@ def _readconfig():
raise ValueError
except (ConfigParser.NoOptionError, ValueError):
abort('You need to define a valid user in auth.cfg')
+
env.password = config.get('userinfo', 'password')
- except ConfigParser.NoSectionError:
- msg = 'You need to define a user and password in the "userinfo" section'
+ env.key_filename = config.get('userinfo','keypair-file')
+ if not env.password and not env.key_filename:
+ raise ValueError
+ except (ConfigParser.NoSectionError, ValueError):
+
+ msg = 'You need to define a user and password or path-to-keypair in the "userinfo" section'
msg += ' of auth.cfg. Refer to the README for help'
msg += ' (http://github.com/tobami/littlechef)'
abort(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment