本文整理汇总了Python中shutit_util.util_raw_input函数的典型用法代码示例。如果您正苦于以下问题:Python util_raw_input函数的具体用法?Python util_raw_input怎么用?Python util_raw_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了util_raw_input函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setup_shutit_path
def setup_shutit_path(cfg):
# try the current directory, the .. directory, or the ../shutit directory, the ~/shutit
if not cfg["host"]["add_shutit_to_path"]:
return
res = shutit_util.util_raw_input(
prompt="shutit appears not to be on your path - should try and we find it and add it to your ~/.bashrc (Y/n)?"
)
if res in ["n", "N"]:
with open(os.path.join(cfg["shutit_home"], "config"), "a") as f:
f.write("\n[host]\nadd_shutit_to_path: no\n")
return
path_to_shutit = ""
for d in [".", "..", "~", "~/shutit"]:
path = os.path.abspath(d + "/shutit")
if not os.path.isfile(path):
continue
path_to_shutit = path
while path_to_shutit == "":
d = shutit_util.util_raw_input(prompt="cannot auto-find shutit - please input the path to your shutit dir\n")
path = os.path.abspath(d + "/shutit")
if not os.path.isfile(path):
continue
path_to_shutit = path
if path_to_shutit != "":
bashrc = os.path.expanduser("~/.bashrc")
with open(bashrc, "a") as myfile:
# http://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
myfile.write('\nexport PATH="$PATH:' + os.path.dirname(path_to_shutit) + '"\n')
shutit_util.util_raw_input(prompt="\nPath set up - please open new terminal and re-run command\n")
sys.exit()
开发者ID:jeromeshi,项目名称:shutit,代码行数:30,代码来源:shutit_main.py
示例2: build_module
def build_module(shutit, module, loglevel=logging.DEBUG):
"""Build passed-in module.
"""
cfg = shutit.cfg
shutit.log('Building ShutIt module: ' + module.module_id + ' with run order: ' + str(module.run_order), level=logging.INFO)
cfg['build']['report'] = (cfg['build']['report'] + '\nBuilding ShutIt module: ' + module.module_id + ' with run order: ' + str(module.run_order))
if not module.build(shutit):
shutit.fail(module.module_id + ' failed on build', shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').pexpect_child)
else:
if cfg['build']['delivery'] in ('docker','dockerfile'):
# Create a directory and files to indicate this has been built.
shutit.send(' mkdir -p ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + ' && touch ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + '/built && rm -f ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + '/removed', loglevel=loglevel)
# Put it into "installed" cache
cfg['environment'][cfg['build']['current_environment_id']]['modules_installed'].append(module.module_id)
# Remove from "not installed" cache
if module.module_id in cfg['environment'][cfg['build']['current_environment_id']]['modules_not_installed']:
cfg['environment'][cfg['build']['current_environment_id']]['modules_not_installed'].remove(module.module_id)
shutit.pause_point('\nPausing to allow inspect of build for: ' + module.module_id, print_input=True, level=2)
cfg['build']['report'] = (cfg['build']['report'] + '\nCompleted module: ' + module.module_id)
if cfg[module.module_id]['shutit.core.module.tag'] or cfg['build']['interactive'] >= 3:
shutit.log(shutit_util.build_report(shutit, '#Module:' + module.module_id), level=logging.DEBUG)
if (not cfg[module.module_id]['shutit.core.module.tag'] and cfg['build']['interactive'] >= 2):
print ("\n\nDo you want to save state now we\'re at the " + "end of this module? (" + module.module_id + ") (input y/n)")
cfg[module.module_id]['shutit.core.module.tag'] = (shutit_util.util_raw_input(shutit=shutit,default='y') == 'y')
if cfg[module.module_id]['shutit.core.module.tag'] or cfg['build']['tag_modules']:
shutit.log(module.module_id + ' configured to be tagged, doing repository work',level=logging.INFO)
# Stop all before we tag to avoid file changing errors, and clean up pid files etc..
stop_all(shutit, module.run_order)
shutit.do_repository_work(str(module.module_id) + '_' + str(module.run_order), password=cfg['host']['password'], docker_executable=cfg['host']['docker_executable'], force=True)
# Start all after we tag to ensure services are up as expected.
start_all(shutit, module.run_order)
if cfg['build']['interactive'] >= 2:
print ("\n\nDo you want to stop interactive mode? (input y/n)\n")
if shutit_util.util_raw_input(shutit=shutit,default='y') == 'y':
cfg['build']['interactive'] = 0
开发者ID:arunsingh,项目名称:shutit,代码行数:35,代码来源:shutit_main.py
示例3: setup_shutit_path
def setup_shutit_path(cfg):
# try the current directory, the .. directory, or the ../shutit directory, the ~/shutit
if not cfg['host']['add_shutit_to_path']:
return
res = shutit_util.util_raw_input(prompt='shutit appears not to be on your path - should try and we find it and add it to your ~/.bashrc (Y/n)?')
if res in ['n','N']:
with open(os.path.join(cfg['shutit_home'], 'config'), 'a') as f:
f.write('\n[host]\nadd_shutit_to_path: no\n')
return
path_to_shutit = ''
for d in ['.','..','~','~/shutit']:
path = os.path.abspath(d + '/shutit')
if not os.path.isfile(path):
continue
path_to_shutit = path
while path_to_shutit == '':
d = shutit_util.util_raw_input(prompt='cannot auto-find shutit - please input the path to your shutit dir\n')
path = os.path.abspath(d + '/shutit')
if not os.path.isfile(path):
continue
path_to_shutit = path
if path_to_shutit != '':
bashrc = os.path.expanduser('~/.bashrc')
with open(bashrc, "a") as myfile:
#http://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
myfile.write('\nexport PATH="$PATH:' + os.path.dirname(path_to_shutit) + '"\n')
shutit_util.util_raw_input(prompt='\nPath set up - please open new terminal and re-run command\n')
sys.exit()
开发者ID:gitter-badger,项目名称:shutit,代码行数:28,代码来源:shutit_main.py
示例4: do_test
def do_test(shutit):
"""Runs test phase, erroring if any return false.
"""
cfg = shutit.cfg
if not cfg['build']['dotest']:
shutit.log('Tests configured off, not running')
return
# Test in reverse order
shutit.log('PHASE: test', code='32')
if cfg['build']['interactive'] >= 3:
print '\nNow doing test phase' + shutit_util.colour('32',
'\n\n[Hit return to continue]\n')
shutit_util.util_raw_input(shutit=shutit)
stop_all(shutit)
start_all(shutit)
for module_id in module_ids(shutit, rev=True):
module = shutit.shutit_map[module_id]
# Only test if it's installed.
if is_installed(shutit, shutit.shutit_map[module_id]):
shutit.log('RUNNING TEST ON: ' + module_id, code='32')
shutit.login(prompt_prefix=module_id,command='bash')
if not shutit.shutit_map[module_id].test(shutit):
shutit.fail(module_id + ' failed on test',
child=shutit.pexpect_children['target_child'])
shutit.logout()
开发者ID:gitter-badger,项目名称:shutit,代码行数:25,代码来源:shutit_main.py
示例5: do_finalize
def do_finalize(shutit):
"""Runs finalize phase; run after all builds are complete and all modules
have been stopped.
"""
cfg = shutit.cfg
# Stop all the modules
if cfg["build"]["interactive"] >= 3:
print (
"\nStopping all modules before finalize phase" + shutit_util.colour("32", "\n\n[Hit return to continue]\n")
)
shutit_util.util_raw_input(shutit=shutit)
stop_all(shutit)
# Finalize in reverse order
shutit.log("PHASE: finalize", code="32")
if cfg["build"]["interactive"] >= 3:
print (
"\nNow doing finalize phase, which we do when all builds are "
+ "complete and modules are stopped"
+ shutit_util.colour("32", "\n\n[Hit return to continue]\n")
)
shutit_util.util_raw_input(shutit=shutit)
# Login at least once to get the exports.
for module_id in module_ids(shutit, rev=True):
# Only finalize if it's thought to be installed.
if is_installed(shutit, shutit.shutit_map[module_id]):
shutit.login(prompt_prefix=module_id, command="bash")
if not shutit.shutit_map[module_id].finalize(shutit):
shutit.fail(module_id + " failed on finalize", child=shutit.pexpect_children["target_child"])
shutit.logout()
开发者ID:jeromeshi,项目名称:shutit,代码行数:29,代码来源:shutit_main.py
示例6: do_finalize
def do_finalize(shutit):
"""Runs finalize phase; run after all builds are complete and all modules
have been stopped.
"""
cfg = shutit.cfg
# Stop all the modules
if cfg['build']['interactive'] >= 3:
print('\nStopping all modules before finalize phase' + shutit_util.colour('32',
'\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input(shutit=shutit)
stop_all(shutit)
# Finalize in reverse order
shutit.log('PHASE: finalize', code='32')
if cfg['build']['interactive'] >= 3:
print('\nNow doing finalize phase, which we do when all builds are ' +
'complete and modules are stopped' +
shutit_util.colour('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input(shutit=shutit)
# Login at least once to get the exports.
for module_id in shutit_util.module_ids(shutit, rev=True):
# Only finalize if it's thought to be installed.
if shutit_util.is_installed(shutit, shutit.shutit_map[module_id]):
shutit.login(prompt_prefix=module_id,command='bash')
if not shutit.shutit_map[module_id].finalize(shutit):
shutit.fail(module_id + ' failed on finalize',
child=shutit.pexpect_children['target_child'])
shutit.logout()
开发者ID:1beb,项目名称:shutit,代码行数:27,代码来源:shutit_main.py
示例7: build
def build(self, shutit):
"""Sets up the machine ready for building.
"""
cfg = shutit.cfg
ssh_host = cfg[self.module_id]['ssh_host']
ssh_port = cfg[self.module_id]['ssh_port']
ssh_user = cfg[self.module_id]['ssh_user']
ssh_pass = cfg[self.module_id]['password']
ssh_key = cfg[self.module_id]['ssh_key']
ssh_cmd = cfg[self.module_id]['ssh_cmd']
opts = [
'-t',
'-o', 'UserKnownHostsFile=/dev/null',
'-o', 'StrictHostKeyChecking=no'
]
if ssh_pass == '':
opts += ['-o', 'PasswordAuthentication=no']
if ssh_port != '':
opts += ['-p', ssh_port]
if ssh_key != '':
opts += ['-i', ssh_key]
host_arg = ssh_host
if host_arg == '':
shutit.fail('No host specified for sshing', throw_exception=False)
if ssh_user != '':
host_arg = ssh_user + '@' + host_arg
cmd_arg = ssh_cmd
if cmd_arg == '':
cmd_arg = 'sudo su -s /bin/bash -'
ssh_command = ['ssh'] + opts + [host_arg, cmd_arg]
if cfg['build']['interactive'] >= 3:
print('\n\nAbout to connect to host.' +
'\n\n' + shutit_util.colour('32', '\n[Hit return to continue]'))
shutit_util.util_raw_input(shutit=shutit)
cfg['build']['ssh_command'] = ' '.join(ssh_command)
shutit.log('\n\nCommand being run is:\n\n' + cfg['build']['ssh_command'],
force_stdout=True, prefix=False)
target_child = pexpect.spawn(ssh_command[0], ssh_command[1:])
expect = ['assword', cfg['expect_prompts']['base_prompt'].strip()]
res = target_child.expect(expect, 10)
while True:
shutit.log(target_child.before + target_child.after, prefix=False,
force_stdout=True)
if res == 0:
shutit.log('...')
res = shutit.send(ssh_pass,
child=target_child, expect=expect, timeout=10,
check_exit=False, fail_on_empty_before=False)
elif res == 1:
shutit.log('Prompt found, breaking out')
break
self._setup_prompts(shutit, target_child)
self._add_begin_build_info(shutit, ssh_command)
return True
开发者ID:gitter-badger,项目名称:shutit,代码行数:54,代码来源:shutit_setup.py
示例8: build
def build(self, shutit, loglevel=logging.DEBUG):
"""Sets up the machine ready for building.
"""
cfg = shutit.cfg
ssh_host = cfg[self.module_id]['ssh_host']
ssh_port = cfg[self.module_id]['ssh_port']
ssh_user = cfg[self.module_id]['ssh_user']
ssh_pass = cfg[self.module_id]['password']
ssh_key = cfg[self.module_id]['ssh_key']
ssh_cmd = cfg[self.module_id]['ssh_cmd']
opts = [
'-t',
'-o', 'UserKnownHostsFile=/dev/null',
'-o', 'StrictHostKeyChecking=no'
]
if ssh_pass == '':
opts += ['-o', 'PasswordAuthentication=no']
if ssh_port != '':
opts += ['-p', ssh_port]
if ssh_key != '':
opts += ['-i', ssh_key]
host_arg = ssh_host
if host_arg == '':
shutit.fail('No host specified for sshing', throw_exception=False)
if ssh_user != '':
host_arg = ssh_user + '@' + host_arg
cmd_arg = ssh_cmd
if cmd_arg == '':
cmd_arg = 'sudo su -s /bin/bash -'
ssh_command = ['ssh'] + opts + [host_arg, cmd_arg]
if shutit.build['interactive'] >= 3:
print('\n\nAbout to connect to host.' + '\n\n' + shutit_util.colourise('32', '\n[Hit return to continue]'))
shutit_util.util_raw_input()
shutit.build['ssh_command'] = ' '.join(ssh_command)
shutit.log('Command being run is: ' + shutit.build['ssh_command'],level=logging.INFO)
shutit_pexpect_session = shutit_pexpect.ShutItPexpectSession('target_child', ssh_command[0], ssh_command[1:])
target_child = shutit_pexpect_session.pexpect_child
expect = ['assword', shutit.expect_prompts['base_prompt'].strip()]
res = shutit.child_expect(target_child,expect, timeout=10)
while True:
shutit.log(target_child.before + target_child.after,level=logging.DEBUG)
if res == 0:
shutit.log('...',level=logging.DEBUG)
res = shutit.send(ssh_pass, shutit_pexpect_child=target_child, expect=expect, timeout=10, check_exit=False, fail_on_empty_before=False, echo=False, loglevel=loglevel)
elif res == 1:
shutit.log('Prompt found, breaking out',level=logging.DEBUG)
break
self.setup_host_child()
self.setup_target_child(target_child)
return True
开发者ID:pombredanne,项目名称:shutit,代码行数:50,代码来源:shutit_setup.py
示例9: init_shutit_map
def init_shutit_map(shutit):
"""Initializes the module map of shutit based on the modules
we have gathered.
Checks we have core modules
Checks for duplicate module details.
Sets up common config.
Sets up map of modules.
"""
cfg = shutit.cfg
modules = shutit.shutit_modules
# Have we got anything to process outside of special modules?
if len([mod for mod in modules if mod.run_order > 0]) < 1:
shutit.log(modules,level=logging.DEBUG)
path = ':'.join(cfg['host']['shutit_module_path'])
shutit.log('\nIf you are new to ShutIt, see:\n\n\thttp://ianmiell.github.io/shutit/\n\nor try running\n\n\tshutit skeleton\n\n',code=32,level=logging.INFO)
if path == '':
shutit.fail('No ShutIt modules aside from core ones found and no ShutIt module path given.\nDid you set --shutit_module_path/-m wrongly?\n')
elif path == '.':
shutit.fail('No modules aside from core ones found and no ShutIt module path given apart from default (.).\n\n- Did you set --shutit_module_path/-m?\n- Is there a STOP* file in your . dir?')
else:
shutit.fail('No modules aside from core ones found and no ShutIt modules in path:\n\n' + path + '\n\nor their subfolders. Check your --shutit_module_path/-m setting and check that there are ShutIt modules below without STOP* files in any relevant directories.')
shutit.log('PHASE: base setup', level=logging.DEBUG)
if cfg['build']['interactive'] >= 3:
shutit.log('\nChecking to see whether there are duplicate module ids or run orders in the visible modules.\nModules I see are:\n',level=logging.DEBUG)
for module in modules:
shutit.log(module.module_id, level=logging.DEBUG)
shutit.log('\n',level=logging.DEBUG)
run_orders = {}
has_core_module = False
for module in modules:
assert isinstance(module, ShutItModule)
if module.module_id in shutit.shutit_map:
shutit.fail('Duplicated module id: ' + module.module_id + '\n\nYou may want to check your --shutit_module_path setting')
if module.run_order in run_orders:
shutit.fail('Duplicate run order: ' + str(module.run_order) + ' for ' + module.module_id + ' and ' + run_orders[module.run_order].module_id + '\n\nYou may want to check your --shutit_module_path setting')
if module.run_order == 0:
has_core_module = True
shutit.shutit_map[module.module_id] = run_orders[module.run_order] = module
if not has_core_module:
shutit.fail('No module with run_order=0 specified! This is required.')
if cfg['build']['interactive'] >= 3:
print(shutit_util.colour('32', 'Module id and run order checks OK\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input(shutit=shutit)
开发者ID:arunsingh,项目名称:shutit,代码行数:50,代码来源:shutit_main.py
示例10: stop_all
def stop_all(shutit, run_order=-1):
"""Runs stop method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we clean up state
before committing run files etc.
"""
cfg = shutit.cfg
if cfg["build"]["interactive"] >= 3:
print ("\nRunning stop on all modules" + shutit_util.colour("32", "\n\n[Hit return to continue]"))
shutit_util.util_raw_input(shutit=shutit)
# sort them so they're stopped in reverse order
for module_id in module_ids(shutit, rev=True):
shutit_module_obj = shutit.shutit_map[module_id]
if run_order == -1 or shutit_module_obj.run_order <= run_order:
if is_installed(shutit, shutit_module_obj):
if not shutit_module_obj.stop(shutit):
shutit.fail("failed to stop: " + module_id, child=shutit.pexpect_children["target_child"])
开发者ID:jeromeshi,项目名称:shutit,代码行数:16,代码来源:shutit_main.py
示例11: start_all
def start_all(run_order=-1):
"""Runs start method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we can export a clean
target and still depended-on modules running if necessary.
"""
shutit = shutit_global.shutit
if shutit.build['interactive'] >= 3:
print('\nRunning start on all modules' + shutit_util.colourise('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input()
# sort them so they're started in order
for module_id in shutit_util.module_ids():
shutit_module_obj = shutit.shutit_map[module_id]
if run_order == -1 or shutit_module_obj.run_order <= run_order:
if shutit_util.is_installed(shutit_module_obj):
if not shutit_module_obj.start(shutit):
shutit.fail('failed to start: ' + module_id, shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').shutit_pexpect_child)
开发者ID:pombredanne,项目名称:shutit,代码行数:16,代码来源:shutit_main.py
示例12: stop_all
def stop_all(run_order=-1):
"""Runs stop method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we clean up state
before committing run files etc.
"""
shutit = shutit_global.shutit
if shutit.build['interactive'] >= 3:
print('\nRunning stop on all modules' + shutit_util.colourise('32', '\n\n[Hit return to continue]'))
shutit_util.util_raw_input()
# sort them so they're stopped in reverse order
for module_id in shutit_util.module_ids(rev=True):
shutit_module_obj = shutit.shutit_map[module_id]
if run_order == -1 or shutit_module_obj.run_order <= run_order:
if shutit_util.is_installed(shutit_module_obj):
if not shutit_module_obj.stop(shutit):
shutit.fail('failed to stop: ' + module_id, shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').shutit_pexpect_child)
开发者ID:pombredanne,项目名称:shutit,代码行数:16,代码来源:shutit_main.py
示例13: start_all
def start_all(shutit, run_order=-1):
"""Runs start method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we can export a clean
target and still depended-on modules running if necessary.
"""
cfg = shutit.cfg
if cfg["build"]["interactive"] >= 3:
print ("\nRunning start on all modules" + shutit_util.colour("32", "\n\n[Hit return to continue]\n"))
shutit_util.util_raw_input(shutit=shutit)
# sort them so they're started in order
for module_id in module_ids(shutit):
shutit_module_obj = shutit.shutit_map[module_id]
if run_order == -1 or shutit_module_obj.run_order <= run_order:
if is_installed(shutit, shutit_module_obj):
if not shutit_module_obj.start(shutit):
shutit.fail("failed to start: " + module_id, child=shutit.pexpect_children["target_child"])
开发者ID:jeromeshi,项目名称:shutit,代码行数:16,代码来源:shutit_main.py
示例14: conn_target
def conn_target(shutit):
"""Connect to the target.
"""
conn_module = None
for mod in shutit.conn_modules:
if mod.module_id == shutit.build['conn_module']:
conn_module = mod
break
if conn_module is None:
shutit.fail('Couldn\'t find conn_module ' + shutit.build['conn_module'])
# Set up the target in pexpect.
if shutit.build['interactive'] >= 3:
print('\nRunning the conn module (' + shutit.shutit_main_dir + '/shutit_setup.py)' + shutit_util.colourise('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input()
conn_module.get_config(shutit)
conn_module.build(shutit)
开发者ID:pombredanne,项目名称:shutit,代码行数:17,代码来源:shutit_main.py
示例15: do_build
def do_build(shutit):
"""Runs build phase, building any modules that we've determined
need building.
"""
cfg = shutit.cfg
shutit.log('PHASE: build, repository work', code='32')
shutit.log(shutit_util.print_config(cfg))
if cfg['build']['interactive'] >= 3:
print ('\nNow building any modules that need building' +
shutit_util.colour('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input(shutit=shutit)
module_id_list = shutit_util.module_ids(shutit)
if cfg['build']['deps_only']:
module_id_list_build_only = filter(lambda x: cfg[x]['shutit.core.module.build'], module_id_list)
for module_id in module_id_list:
module = shutit.shutit_map[module_id]
shutit.log('considering whether to build: ' + module.module_id,
code='32')
if cfg[module.module_id]['shutit.core.module.build']:
if cfg['build']['delivery'] not in module.ok_delivery_methods:
shutit.fail('Module: ' + module.module_id + ' can only be built with one of these --delivery methods: ' + str(module.ok_delivery_methods) + '\nSee shutit build -h for more info, or try adding: --delivery <method> to your shutit invocation')
if shutit_util.is_installed(shutit,module):
cfg['build']['report'] = (cfg['build']['report'] +
'\nBuilt already: ' + module.module_id +
' with run order: ' + str(module.run_order))
else:
# We move to the module directory to perform the build, returning immediately afterwards.
if cfg['build']['deps_only'] and module_id == module_id_list_build_only[-1]:
# If this is the last module, and we are only building deps, stop here.
cfg['build']['report'] = (cfg['build']['report'] + '\nSkipping: ' +
module.module_id + ' with run order: ' + str(module.run_order) +
'\n\tas this is the final module and we are building dependencies only')
else:
revert_dir = os.getcwd()
cfg['environment'][cfg['build']['current_environment_id']]['module_root_dir'] = os.path.dirname(module.__module_file)
shutit.chdir(cfg['environment'][cfg['build']['current_environment_id']]['module_root_dir'])
shutit.login(prompt_prefix=module_id,command='bash')
build_module(shutit, module)
shutit.logout()
shutit.chdir(revert_dir)
if shutit_util.is_installed(shutit, module):
shutit.log('Starting module')
if not module.start(shutit):
shutit.fail(module.module_id + ' failed on start',
child=shutit.pexpect_children['target_child'])
开发者ID:1beb,项目名称:shutit,代码行数:45,代码来源:shutit_main.py
示例16: do_test
def do_test():
"""Runs test phase, erroring if any return false.
"""
shutit = shutit_global.shutit
if not shutit.build['dotest']:
shutit.log('Tests configured off, not running',level=logging.DEBUG)
return
# Test in reverse order
shutit.log('PHASE: test', level=logging.DEBUG)
if shutit.build['interactive'] >= 3:
print '\nNow doing test phase' + shutit_util.colourise('32', '\n\n[Hit return to continue]\n')
shutit_util.util_raw_input()
stop_all()
start_all()
for module_id in shutit_util.module_ids(rev=True):
# Only test if it's installed.
if shutit_util.is_installed(shutit.shutit_map[module_id]):
shutit.log('RUNNING TEST ON: ' + module_id, level=logging.DEBUG)
shutit.login(prompt_prefix=module_id,command='bash')
if not shutit.shutit_map[module_id].test(shutit):
shutit.fail(module_id + ' failed on test', shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').pexpect_child)
shutit.logout()
开发者ID:pombredanne,项目名称:shutit,代码行数:22,代码来源:shutit_main.py
示例17: do_finalize
def do_finalize():
"""Runs finalize phase; run after all builds are complete and all modules
have been stopped.
"""
shutit = shutit_global.shutit
# Stop all the modules
if shutit.build['interactive'] >= 3:
print('\nStopping all modules before finalize phase' + shutit_util.colourise('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input()
stop_all()
# Finalize in reverse order
shutit.log('PHASE: finalize', level=logging.DEBUG)
if shutit.build['interactive'] >= 3:
print('\nNow doing finalize phase, which we do when all builds are ' + 'complete and modules are stopped' + shutit_util.colourise('32', '\n\n[Hit return to continue]\n'))
shutit_util.util_raw_input()
# Login at least once to get the exports.
for module_id in shutit_util.module_ids(rev=True):
# Only finalize if it's thought to be installed.
if shutit_util.is_installed(shutit.shutit_map[module_id]):
shutit.login(prompt_prefix=module_id,command='bash')
if not shutit.shutit_map[module_id].finalize(shutit):
shutit.fail(module_id + ' failed on finalize', shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').pexpect_child)
shutit.logout()
开发者ID:pombredanne,项目名称:shutit,代码行数:23,代码来源:shutit_main.py
示例18: do_test
def do_test(shutit):
"""Runs test phase, erroring if any return false.
"""
cfg = shutit.cfg
if not cfg["build"]["dotest"]:
shutit.log("Tests configured off, not running")
return
# Test in reverse order
shutit.log("PHASE: test", code="32")
if cfg["build"]["interactive"] >= 3:
print "\nNow doing test phase" + shutit_util.colour("32", "\n\n[Hit return to continue]\n")
shutit_util.util_raw_input(shutit=shutit)
stop_all(shutit)
start_all(shutit)
for module_id in module_ids(shutit, rev=True):
module = shutit.shutit_map[module_id]
# Only test if it's installed.
if is_installed(shutit, shutit.shutit_map[module_id]):
shutit.log("RUNNING TEST ON: " + module_id, code="32")
shutit.login(prompt_prefix=module_id, command="bash")
if not shutit.shutit_map[module_id].test(shutit):
shutit.fail(module_id + " failed on test", child=shutit.pexpect_children["target_child"])
shutit.logout()
开发者ID:jeromeshi,项目名称:shutit,代码行数:23,代码来源:shutit_main.py
示例19: conn_target
def conn_target(shutit):
"""Connect to the target.
"""
cfg = shutit.cfg
conn_module = None
cfg = shutit.cfg
for mod in shutit.conn_modules:
if mod.module_id == cfg["build"]["conn_module"]:
conn_module = mod
break
if conn_module is None:
shutit.fail("Couldn't find conn_module " + cfg["build"]["conn_module"])
# Set up the target in pexpect.
if cfg["build"]["interactive"] >= 3:
print (
"\nRunning the conn module ("
+ shutit.shutit_main_dir
+ "/shutit_setup.py)"
+ shutit_util.colour("32", "\n\n[Hit return to continue]\n")
)
shutit_util.util_raw_input(shutit=shutit)
conn_module.get_config(shutit)
conn_module.build(shutit)
开发者ID:jeromeshi,项目名称:shutit,代码行数:24,代码来源:shutit_main.py
示例20: do_phone_home
def do_phone_home(msg=None,question='Error seen - would you like to inform the maintainers?'):
"""Report message home.
msg - message to send home
question - question to ask - assumes Y/y for send message, else no
"""
if msg is None:
msg = {}
if shutit_global.shutit.shutit.build['interactive'] == 0:
return
msg.update({'shutitrunstatus':'fail','pwd':os.getcwd(),'user':os.environ.get('LOGNAME', '')})
if question != '' and shutit_util.util_raw_input(prompt=question + ' (Y/n)\n') not in ('y','Y',''):
return
try:
urllib.urlopen("http://shutit.tk?" + urllib.urlencode(msg))
except Exception as e:
shutit_global.shutit.log('failed to send message: ' + str(e.message),level=logging.ERROR)
开发者ID:hackur,项目名称:shutit,代码行数:16,代码来源:shutit_main.py
注:本文中的shutit_util.util_raw_input函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论