"""
Get the name of the distro that we are using (usually the os_type).
"""
- os_type = None
+ # ubuntu is our default distro choice
+ os_type = "ubuntu"
if ctx.os_type:
return ctx.os_type
try:
- os_type = ctx.config.get('os_type', None)
+ os_type = ctx.config.get('os_type', os_type)
except AttributeError:
pass
- # next, look for an override in the downburst config for os_type
- # FIXME: checking the downburst config for distro shouldn't be needed
- # as it's only used in provision.create_if_vm and that function performs
- # this check again while building the config for downburst. Leaving it
- # here for now until we can fully investigate and test it's removal.
- try:
- os_type = ctx.config['downburst'].get('distro', os_type)
- except (KeyError, AttributeError):
- pass
- if os_type is None:
- # default to ubuntu if we can't find the os_type anywhere else
- return "ubuntu"
+
return os_type
os_version = ctx.config.get('os_version', default_os_version[distro])
except AttributeError:
os_version = default_os_version[distro]
- try:
- return ctx.config['downburst'].get('distroversion', os_version)
- except (KeyError, AttributeError):
- return os_version
+ return os_version
def get_multi_machine_types(machinetype):
distro = get_distro(self.fake_ctx)
assert distro == 'centos'
- def test_teuth_config_downburst(self):
- self.fake_ctx.config = {'downburst' : {'distro': 'sles'}}
- distro = get_distro(self.fake_ctx)
- assert distro == 'sles'
-
def test_no_config_or_os_type(self):
self.fake_ctx = Mock()
self.fake_ctx.os_type = None
distroversion = get_distro_version(self.fake_ctx)
assert distroversion == '13.04'
- def test_teuth_config_downburst_version(self):
- #Argument takes precidence
- self.fake_ctx.os_version = '13.10'
- self.fake_ctx.config = {'downburst' : {'distroversion': '13.04'}}
- distroversion = get_distro_version(self.fake_ctx)
- assert distroversion == '13.10'
-
def test_teuth_config_noarg_version(self):
self.fake_ctx_noarg.config = {'os_version': '13.04'}
distroversion = get_distro_version(self.fake_ctx_noarg)
assert distroversion == '13.04'
- def test_teuth_config_downburst_noarg_version(self):
- self.fake_ctx_noarg.config = {'downburst' : {'distroversion': '13.04'}}
- distroversion = get_distro_version(self.fake_ctx_noarg)
+ def test_no_teuth_config(self):
+ self.fake_ctx = Mock()
+ self.fake_ctx.os_type = None
+ self.fake_ctx.os_version = '13.04'
+ distroversion = get_distro_version(self.fake_ctx)
assert distroversion == '13.04'