diff options
Diffstat (limited to 'lib.py')
-rw-r--r-- | lib.py | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -12,3 +12,34 @@ srcdir = os.environ['SRCDIR'] datadir = os.environ['DATADIR'] vars = Variables(datadir) + + + +def gitano(user, args, stdin=None): + server = os.environ['GITANO_SERVER'] + kwargs = { + 'stderr': subprocess.STDOUT, + 'ssh_options': [ + '-oPasswordAuthentication=no', + '-oIdentitiesOnly=yes', + '-i', self.get_user_ssh_key(user), + ], + } + if stdin is not None: + kwargs['feed_stdin'] = stdin + return cliapp.ssh_runcmd( + 'git@{}'.format(server), + args.split(), + **kwargs) + + + +def gitano_confirm_with_token(prefix, which): + try: + output = gitano(None, '{} {}'.format(prefix, which)) + except cliapp.AppException: + pass + else: + last_line = output.splitlines()[-1] + token = last_line.split()[-1] + gitano(None, '{} {} {}'.format(prefix, which, token)) |