本文整理汇总了Python中kiwi.xml_state.XMLState.set_container_config_tag方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.set_container_config_tag方法的具体用法?Python XMLState.set_container_config_tag怎么用?Python XMLState.set_container_config_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.xml_state.XMLState
的用法示例。
在下文中一共展示了XMLState.set_container_config_tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_container_tag
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import set_container_config_tag [as 别名]
def test_set_container_tag(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
state.set_container_config_tag('new_tag')
config = state.get_container_config()
assert config['container_tag'] == 'new_tag'
示例2: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import set_container_config_tag [as 别名]
#.........这里部分代码省略.........
self.state.delete_repository_sections_used_for_build()
assert self.state.get_repository_sections()[0].get_imageonly()
def test_get_build_type_vmconfig_entries(self):
assert self.state.get_build_type_vmconfig_entries() == []
def test_get_build_type_vmconfig_entries_for_vmx_type(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_build_type_vmconfig_entries() == [
'numvcpus = "4"', 'cpuid.coresPerSocket = "2"'
]
def test_get_build_type_vmconfig_entries_no_machine_section(self):
description = XMLDescription('../data/example_disk_config.xml')
xml_data = description.load()
state = XMLState(xml_data)
assert state.get_build_type_vmconfig_entries() == []
def test_get_build_type_docker_containerconfig_section(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
containerconfig = state.get_build_type_containerconfig_section()
assert containerconfig.get_name() == \
'container_name'
assert containerconfig.get_maintainer() == \
'tux'
assert containerconfig.get_workingdir() == \
'/root'
def test_set_container_tag(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
state.set_container_config_tag('new_tag')
config = state.get_container_config()
assert config['container_tag'] == 'new_tag'
@patch('kiwi.logger.log.warning')
def test_set_container_tag_not_applied(self, mock_log_warn):
self.state.set_container_config_tag('new_tag')
assert mock_log_warn.called
def test_get_container_config(self):
expected_config = {
'labels': [
'--config.label=somelabel=labelvalue',
'--config.label=someotherlabel=anotherlabelvalue'
],
'maintainer': ['--author=tux'],
'entry_subcommand': [
'--config.cmd=ls',
'--config.cmd=-l'
],
'container_name': 'container_name',
'container_tag': 'container_tag',
'additional_tags': ['current', 'foobar'],
'workingdir': ['--config.workingdir=/root'],
'environment': [
'--config.env=PATH=/bin:/usr/bin:/home/user/bin',
'--config.env=SOMEVAR=somevalue'
],
'user': ['--config.user=root'],
'volumes': [
'--config.volume=/tmp',
'--config.volume=/var/log'
],