本文整理汇总了Python中cattle.Config.builds方法的典型用法代码示例。如果您正苦于以下问题:Python Config.builds方法的具体用法?Python Config.builds怎么用?Python Config.builds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cattle.Config
的用法示例。
在下文中一共展示了Config.builds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _image_build
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import builds [as 别名]
def _image_build(self, image, progress):
client = docker_client()
opts = dict(image.data.fields.build)
def do_build():
for key in ['context', 'remote']:
if key in opts:
del opts[key]
opts['stream'] = True
opts['rm'] = True
marshaller = get_type(MARSHALLER)
for status in client.build(**opts):
try:
status = marshaller.from_string(status)
progress.update(status['stream'])
except:
pass
if is_str_set(opts, 'context'):
downloaded = None
try:
downloaded = download_file(opts['context'], Config.builds())
with open(downloaded) as f:
del opts['context']
opts['fileobj'] = f
opts['custom_context'] = True
do_build()
finally:
if downloaded is not None:
os.remove(downloaded)
else:
remote = opts['remote']
if remote.startswith('[email protected]:'):
remote = remote.replace('[email protected]:', 'git://github.com/')
del opts['remote']
opts['path'] = remote
do_build()