Commit a025e535 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Iustin Pop
Browse files

Fix OS_VARIANT variable setting

This was introduced in efaa9b06


 in OSCoreEnv: is pure operating system name (without variant) as variant is stripped
   in OSFromDisk(). So we always get variant = inst_os.supported_variants[0] (first
   variant in variants list).
  Adding argument os_name with full name (including variant) solves this problem.
Signed-off-by: default avatarVitaly Kuznetsov <>
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarIustin Pop <>
[modified by iustin to handle the call to OSCoreEnv from ValidateOS too]
Reviewed-by: default avatarMichael Hanselmann <>
parent 5117f822
# Copyright (C) 2006, 2007 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -1952,9 +1952,11 @@ def OSFromDisk(name, base_dir=None):
return payload
def OSCoreEnv(inst_os, os_params, debug=0):
def OSCoreEnv(os_name, inst_os, os_params, debug=0):
"""Calculate the basic environment for an os script.
@type os_name: str
@param os_name: full operating system name (including variant)
@type inst_os: L{objects.OS}
@param inst_os: operating system for which the environment is being built
@type os_params: dict
......@@ -1977,7 +1979,7 @@ def OSCoreEnv(inst_os, os_params, debug=0):
# OS variants
if api_version >= constants.OS_API_V15:
variant ='+', 1)[1]
variant = os_name.split('+', 1)[1]
except IndexError:
variant = inst_os.supported_variants[0]
result['OS_VARIANT'] = variant
......@@ -2004,7 +2006,7 @@ def OSEnvironment(instance, inst_os, debug=0):
cannot be found
result = OSCoreEnv(inst_os, instance.osparams, debug=debug)
result = OSCoreEnv(instance.os, inst_os, instance.osparams, debug=debug)
result['INSTANCE_NAME'] =
result['INSTANCE_OS'] = instance.os
......@@ -2541,7 +2543,7 @@ def ValidateOS(required, osname, checks, osparams):
if constants.OS_VALIDATE_PARAMETERS in checks:
_CheckOSPList(tbv, osparams.keys())
validate_env = OSCoreEnv(tbv, osparams)
validate_env = OSCoreEnv(osname, tbv, osparams)
result = utils.RunCmd([tbv.verify_script] + checks, env=validate_env,
if result.failed:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment