These values are used by downburst to create the virtual machine.
+When locking a file, a downburst meta-data yaml file can be specified by using
+the downburst-conf parameter on the command line.
+
HOST KEYS:
----------
default=None,
help='OS (distro) version such as "12.10"',
)
+ parser.add_argument(
+ '--downburst-conf',
+ default=None,
+ help='Downburst meta-data yaml file to be used for vps machines',
+ )
return parser.parse_args()
createMe = decanonicalize_hostname(machine_name)
with tempfile.NamedTemporaryFile() as tmp:
try:
- lcnfg = ctx.config['downburst']
- except (KeyError, AttributeError):
- lcnfg = {}
+ lfile = ctx.downburst_conf
+ with open(lfile) as downb_yaml:
+ lcnfg = yaml.safe_load(downb_yaml)
+ if lcnfg.keys() == ['downburst']:
+ lcnfg = lcnfg['downburst']
+ except (TypeError, AttributeError):
+ try:
+ lcnfg = {}
+ for tdict in ctx.config['downburst']:
+ for key in tdict:
+ lcnfg[key] = tdict[key]
+ except (KeyError, AttributeError):
+ lcnfg = {}
+ except IOError:
+ print "Error reading %s" % lfile
+ return False
distro = lcnfg.get('distro', os_type.lower())
distroversion = lcnfg.get('distroversion', os_version)