PageRenderTime 102ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 57ms app.codeStats 0ms

/silverlining/commands/diff.py

https://bitbucket.org/ianb/silverlining/
Python | 25 lines | 22 code | 2 blank | 1 comment | 1 complexity | 3a4f5cb0e6949fafca6021549e701563 MD5 | raw file
 1"""Update/deploy an application"""
 2import os
 3import random
 4from silversupport.shell import ssh
 5from silversupport.appconfig import AppConfig
 6
 7
 8def command_diff(config):
 9    app_config = AppConfig(os.path.join(config.args.dir, 'app.ini'),
10                           app_name=config.args.app_name)
11    tmp_location = '/tmp/temp-diff-app.%s.%s.%s' % (
12        app_config.app_name, random.randint(1, 100000), os.getpid())
13    if config.args.instance_name:
14        inst = '--instance-name=%s' % config.args.instance_name
15    else:
16        inst = ''
17    ssh('www-mgr', config.node_hostname,
18        '/usr/local/share/silverlining/mgr-scripts/prepare-temp.py %s %s %s %s'
19        % (tmp_location, config.node_hostname, app_config.app_name,
20           inst))
21    app_config.sync('www-mgr@' + config.node_hostname, tmp_location)
22    ssh('www-mgr', config.node_hostname,
23        '/usr/local/share/silverlining/mgr-scripts/app-diff.py %s %s %s %s'
24        % (tmp_location, config.node_hostname, app_config.app_name,
25           inst))