本文整理汇总了Python中utils.ssh.SSHClient.run_rake_command方法的典型用法代码示例。如果您正苦于以下问题:Python SSHClient.run_rake_command方法的具体用法?Python SSHClient.run_rake_command怎么用?Python SSHClient.run_rake_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.ssh.SSHClient
的用法示例。
在下文中一共展示了SSHClient.run_rake_command方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from utils.ssh import SSHClient [as 别名]
# 或者: from utils.ssh.SSHClient import run_rake_command [as 别名]
def main():
parser = argparse.ArgumentParser(epilog=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('address', help='hostname or ip address of target appliance',
nargs='?', default=None)
args = parser.parse_args()
ssh_kwargs = {
'username': credentials['ssh']['username'],
'password': credentials['ssh']['password'],
}
if args.address:
ssh_kwargs['hostname'] = args.address
# Init SSH client
ssh_client = SSHClient(**ssh_kwargs)
# compile assets if required (not required on 5.2)
if not ssh_client.get_version().startswith("5.2"):
if ssh_client.run_command("ls /var/www/miq/vmdb/public/assets")[0] != 0:
ssh_client.run_rake_command("assets:precompile")
ssh_client.run_rake_command("evm:restart")
print "CFME UI worker restarted, UI should be available shortly"
示例2: main
# 需要导入模块: from utils.ssh import SSHClient [as 别名]
# 或者: from utils.ssh.SSHClient import run_rake_command [as 别名]
def main():
parser = argparse.ArgumentParser(epilog=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('hostname', nargs='?', default=None,
help='hostname or ip address of target appliance')
parser.add_argument('source', nargs='?', default='ManageIQ',
help='Source Domain name')
parser.add_argument('dest', nargs='?', default='Default',
help='Destination Domain name')
parser.add_argument('username', nargs='?', default=credentials['ssh']['username'],
help='SSH username for target appliance')
parser.add_argument('password', nargs='?', default=credentials['ssh']['password'],
help='SSH password for target appliance')
args = parser.parse_args()
ssh_kwargs = {
'username': args.username,
'password': args.password
}
if args.hostname is not None:
ssh_kwargs['hostname'] = args.hostname
client = SSHClient(stream_output=True, **ssh_kwargs)
# Make sure the working dir exists
client.run_command('mkdir -p /tmp/miq')
print 'Exporting domain...'
export_opts = 'DOMAIN={} EXPORT_DIR=/tmp/miq PREVIEW=false OVERWRITE=true'.format(args.source)
export_cmd = 'evm:automate:export {}'.format(export_opts)
print export_cmd
client.run_rake_command(export_cmd)
ro_fix_cmd = "sed -i 's/system: true/system: false/g' /tmp/miq/ManageIQ/__domain__.yaml"
client.run_command(ro_fix_cmd)
import_opts = 'DOMAIN={} IMPORT_DIR=/tmp/miq PREVIEW=false'.format(args.source)
import_opts += ' OVERWRITE=true IMPORT_AS={}'.format(args.dest)
import_cmd = 'evm:automate:import {}'.format(import_opts)
print import_cmd
client.run_rake_command(import_cmd)
示例3: main
# 需要导入模块: from utils.ssh import SSHClient [as 别名]
# 或者: from utils.ssh.SSHClient import run_rake_command [as 别名]
def main():
parser = argparse.ArgumentParser(epilog=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('hostname', nargs='?', default=None,
help='hostname or ip address of target appliance')
parser.add_argument('username', nargs='?', default=credentials['ssh']['username'],
help='SSH username for target appliance')
parser.add_argument('password', nargs='?', default=credentials['ssh']['password'],
help='SSH password for target appliance')
args = parser.parse_args()
ssh_kwargs = {
'username': args.username,
'password': args.password
}
if args.hostname is not None:
ssh_kwargs['hostname'] = args.hostname
client = SSHClient(stream_output=True, **ssh_kwargs)
# `service evmserverd stop` is a little slow, and we're destroying the
# db, so rudely killing ruby speeds things up significantly
print 'Stopping ruby processes...'
client.run_command('killall ruby')
client.run_rake_command('evm:db:reset')
client.run_command('service evmserverd start')
print 'Waiting for appliance UI...'
args = [
scripts_path.join('wait_for_appliance_ui.py').strpath,
# SSHClient has the smarts to get our hostname if none was provided
# Soon, utils.appliance.Appliance will be able to do all of this
# and this will be made good
'http://%s' % client._connect_kwargs['hostname']
]
return subprocess.call(args)