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"
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)
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)
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)
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)