本文整理汇总了Python中solaris_install.engine.InstallEngine.dataset方法的典型用法代码示例。如果您正苦于以下问题:Python InstallEngine.dataset方法的具体用法?Python InstallEngine.dataset怎么用?Python InstallEngine.dataset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solaris_install.engine.InstallEngine
的用法示例。
在下文中一共展示了InstallEngine.dataset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from solaris_install.engine import InstallEngine [as 别名]
# 或者: from solaris_install.engine.InstallEngine import dataset [as 别名]
def main():
""" primary execution function for distro_const
"""
# clear the error service to be sure that we start with a clean slate
errsvc.clear_error_list()
options, args = parse_args()
manifest = args[-1]
pause_checkpoint = None
resume_checkpoint = None
verbose = options.verbose
list_cps = options.list_checkpoints
try:
# We initialize the Engine with stop_on_error set so that if there are
# errors during manifest parsing, the processing stops
eng = InstallEngine(debug=False, stop_on_error=True)
global DC_LOGGER
DC_LOGGER = logging.getLogger(INSTALL_LOGGER_NAME)
# set the logfile name
log_name = "log.%s" % time.strftime("%Y-%m-%d.%H:%M")
detail_log_name = "detail-%s" % log_name
simple_log_name = "simple-%s" % log_name
# create an additional FileHandler for a simple log
base, logfile = os.path.split(DEFAULTLOG)
simple_logname = os.path.join(base, "simple-" + logfile)
simple_fh = FileHandler(simple_logname)
simple_fh.setLevel(logging.INFO)
DC_LOGGER.addHandler(simple_fh)
if options.resume_checkpoint:
resume_checkpoint = options.resume_checkpoint
DC_LOGGER.info("distro_const will resume from: " + \
resume_checkpoint)
if options.pause_checkpoint:
pause_checkpoint = options.pause_checkpoint
DC_LOGGER.info("distro_const will pause at: " + pause_checkpoint)
# create a simple StreamHandler to output messages to the screen
set_stream_handler(DC_LOGGER, list_cps, verbose)
base_dataset = None
parse_manifest(manifest)
# get a reference to the data object cache
doc = eng.data_object_cache
# validate the target section of the manifest
zpool_name, base_dataset, base_action, base_dataset_mp = \
validate_target()
if list_cps:
# set the execute flag of setup_build_dataset to 'False'
# to prevent any actions from occuring. The TI checkpoint
# needs to be registered with the engine for list_checkpoints
# to work correctly.
setup_build_dataset(zpool_name, base_dataset, base_action,
base_dataset_mp, resume_checkpoint, execute=False)
# set the InstallEngine.dataset property to enable snapshots
eng.dataset = os.path.join(zpool_name, base_dataset, "build_data")
list_checkpoints(DC_LOGGER)
else:
(base_dataset_mp, build_data_mp, logs_mp, media_mp) = \
setup_build_dataset(zpool_name, base_dataset, base_action,
base_dataset_mp, resume_checkpoint)
# update the DOC with actual directory values
update_doc_paths(build_data_mp)
# lock the dataset
with Lockfile(os.path.join(base_dataset_mp, DC_LOCKFILE)):
# output the log file path to the screen and transfer the logs
new_detaillog = os.path.join(logs_mp, detail_log_name)
new_simplelog = os.path.join(logs_mp, simple_log_name)
DC_LOGGER.info("Simple log: %s" % new_simplelog)
DC_LOGGER.info("Detail Log: %s" % new_detaillog)
DC_LOGGER.transfer_log(destination=new_detaillog)
simple_fh.transfer_log(destination=new_simplelog)
# set the http_proxy if one is specified in the manifest
dc_set_http_proxy(DC_LOGGER)
# reset the InstallEngine.dataset property to enable snapshots
eng.dataset = os.path.join(zpool_name, base_dataset,
"build_data")
# register each checkpoint listed in the execution section
registered_checkpoints = register_checkpoints(DC_LOGGER)
# now populate the DOC with the common information needed
# by the various checkpoints -- pkg_img_path, etc
doc_dict = {"pkg_img_path": os.path.join(build_data_mp,
"pkg_image"),
#.........这里部分代码省略.........