本文整理汇总了Python中kiwi.xml_state.XMLState.set_derived_from_image_uri方法的典型用法代码示例。如果您正苦于以下问题:Python XMLState.set_derived_from_image_uri方法的具体用法?Python XMLState.set_derived_from_image_uri怎么用?Python XMLState.set_derived_from_image_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.xml_state.XMLState
的用法示例。
在下文中一共展示了XMLState.set_derived_from_image_uri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_derived_from_image_uri
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import set_derived_from_image_uri [as 别名]
def test_set_derived_from_image_uri(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['derivedContainer'], 'docker')
state.set_derived_from_image_uri('file:///new_uri')
assert state.get_derived_from_image_uri().translate() == '/new_uri'
示例2: TestXMLState
# 需要导入模块: from kiwi.xml_state import XMLState [as 别名]
# 或者: from kiwi.xml_state.XMLState import set_derived_from_image_uri [as 别名]
#.........这里部分代码省略.........
'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'
],
'entry_command': [
'--config.entrypoint=/bin/bash',
'--config.entrypoint=-x'
],
'expose_ports': [
'--config.exposedports=80',
'--config.exposedports=8080'
]
}
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
assert state.get_container_config() == expected_config
def test_get_container_config_clear_commands(self):
expected_config = {
'maintainer': ['--author=tux'],
'entry_subcommand': [
'--clear=config.cmd'
],
'container_name': 'container_name',
'container_tag': 'container_tag',
'workingdir': ['--config.workingdir=/root'],
'user': ['--config.user=root'],
'entry_command': [
'--clear=config.entrypoint',
]
}
xml_data = self.description.load()
state = XMLState(xml_data, ['derivedContainer'], 'docker')
assert state.get_container_config() == expected_config
def test_get_spare_part(self):
assert self.state.get_build_type_spare_part_size() == 200
def test_get_build_type_format_options(self):
assert self.state.get_build_type_format_options() == {
'super': 'man',
'force_size': None
}
def test_get_derived_from_image_uri(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['derivedContainer'], 'docker')
assert state.get_derived_from_image_uri().uri == \
'obs://project/repo/image#mytag'
def test_set_derived_from_image_uri(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['derivedContainer'], 'docker')
state.set_derived_from_image_uri('file:///new_uri')
assert state.get_derived_from_image_uri().translate() == '/new_uri'
@patch('kiwi.logger.log.warning')
def test_set_derived_from_image_uri_not_applied(self, mock_log_warn):
self.state.set_derived_from_image_uri('file:///new_uri')
assert mock_log_warn.called
def test_is_xen_server(self):
assert self.state.is_xen_server() is True
def test_is_xen_guest_by_machine_setup(self):
assert self.state.is_xen_guest() is True
def test_is_xen_guest_by_firmware_setup(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['ec2Flavour'], 'vmx')
assert state.is_xen_guest() is True
def test_get_initrd_system(self):
xml_data = self.description.load()
state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
assert state.get_initrd_system() == 'dracut'
state = XMLState(xml_data, ['vmxFlavour'], 'iso')
assert state.get_initrd_system() == 'dracut'
state = XMLState(xml_data, ['vmxFlavour'], 'docker')
assert state.get_initrd_system() is None
state = XMLState(xml_data, [], 'oem')
assert state.get_initrd_system() == 'kiwi'