Revision a025e535

b/lib/backend.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
1952 1952
  return payload
1953 1953

  
1954 1954

  
1955
def OSCoreEnv(inst_os, os_params, debug=0):
1955
def OSCoreEnv(os_name, inst_os, os_params, debug=0):
1956 1956
  """Calculate the basic environment for an os script.
1957 1957

  
1958
  @type os_name: str
1959
  @param os_name: full operating system name (including variant)
1958 1960
  @type inst_os: L{objects.OS}
1959 1961
  @param inst_os: operating system for which the environment is being built
1960 1962
  @type os_params: dict
......
1977 1979
  # OS variants
1978 1980
  if api_version >= constants.OS_API_V15:
1979 1981
    try:
1980
      variant = inst_os.name.split('+', 1)[1]
1982
      variant = os_name.split('+', 1)[1]
1981 1983
    except IndexError:
1982 1984
      variant = inst_os.supported_variants[0]
1983 1985
    result['OS_VARIANT'] = variant
......
2004 2006
      cannot be found
2005 2007

  
2006 2008
  """
2007
  result = OSCoreEnv(inst_os, instance.osparams, debug=debug)
2009
  result = OSCoreEnv(instance.os, inst_os, instance.osparams, debug=debug)
2008 2010

  
2009 2011
  result['INSTANCE_NAME'] = instance.name
2010 2012
  result['INSTANCE_OS'] = instance.os
......
2541 2543
  if constants.OS_VALIDATE_PARAMETERS in checks:
2542 2544
    _CheckOSPList(tbv, osparams.keys())
2543 2545

  
2544
  validate_env = OSCoreEnv(tbv, osparams)
2546
  validate_env = OSCoreEnv(osname, tbv, osparams)
2545 2547
  result = utils.RunCmd([tbv.verify_script] + checks, env=validate_env,
2546 2548
                        cwd=tbv.path)
2547 2549
  if result.failed:

Also available in: Unified diff