summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/deploy.py31
-rwxr-xr-xdeploy/get_conf.py26
2 files changed, 26 insertions, 31 deletions
diff --git a/deploy/deploy.py b/deploy/deploy.py
index 42a9d2f7..245776fb 100644
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
@@ -53,19 +53,8 @@ from environment import (
class DaisyDeployment(object):
def __init__(self, **kwargs):
- self.lab_name = kwargs['lab_name']
- self.pod_name = kwargs['pod_name']
- self.src_deploy_file = kwargs['deploy_file']
- self.net_file = kwargs['net_file']
- self.bin_file = kwargs['bin_file']
- self.daisy_only = kwargs['daisy_only']
- self.cleanup_only = kwargs['cleanup_only']
- self.remote_dir = kwargs['remote_dir']
- self.work_dir = kwargs['work_dir']
- self.storage_dir = kwargs['storage_dir']
- self.pxe_bridge = kwargs['pxe_bridge']
- self.deploy_log = kwargs['deploy_log']
- self.scenario = kwargs['scenario']
+ for key in kwargs:
+ self.__setattr__(key, kwargs[key])
self.deploy_struct = self._construct_final_deploy_conf(self.scenario)
self.deploy_file, self.deploy_file_name = self._construct_final_deploy_file(self.deploy_struct, self.work_dir)
@@ -130,8 +119,8 @@ class DaisyDeployment(object):
LW('INSTALLER_IP is not provided. Use deploy.yml in POD configuration directory !')
return None
- pdf_yaml = path_join(WORKSPACE, 'labs', self.lab_name, self.pod_name + '.yaml')
- template_file = path_join(WORKSPACE, 'securedlab/installers/daisy/pod_config.yaml.j2')
+ pdf_yaml = path_join(self.labs_dir, 'labs', self.lab_name, self.pod_name + '.yaml')
+ template_file = path_join(self.labs_dir, 'installers/daisy/pod_config.yaml.j2')
if not os.access(pdf_yaml, os.R_OK) or not os.access(template_file, os.R_OK):
LI('There is not a POD Descriptor File or an installer template file for this deployment.')
LI('Use deploy.yml in POD configuration directory !')
@@ -207,8 +196,13 @@ class DaisyDeployment(object):
def config_arg_parser():
parser = argparse.ArgumentParser(prog='python %s' % __file__,
+ formatter_class=argparse.RawTextHelpFormatter,
description='NOTE: You need ROOT privilege to run this script.')
+ parser.add_argument('-L', dest='labs_dir', action='store',
+ default=None, required=True,
+ help='Base directory to store the labs configuration')
+
parser.add_argument('-lab', dest='lab_name', action='store',
default=None, required=True,
help='Lab Name')
@@ -239,7 +233,7 @@ def config_arg_parser():
help='Storage directory for VM images')
parser.add_argument('-B', dest='pxe_bridge', action='store',
default='pxebr',
- help='Linux Bridge for booting up the Daisy Server VM '
+ help='Linux Bridge for booting up the Daisy Server VM\n'
'[default: pxebr]')
parser.add_argument('-log', dest='deploy_log', action='store',
default=path_join(WORKSPACE, 'deploy.log'),
@@ -261,7 +255,7 @@ def parse_arguments():
check_scenario_valid(args.scenario)
- conf_base_dir = path_join(WORKSPACE, 'labs', args.lab_name, args.pod_name)
+ conf_base_dir = path_join(args.labs_dir, 'labs', args.lab_name, args.pod_name)
deploy_file = path_join(conf_base_dir, 'daisy/config/deploy.yml')
net_file = path_join(conf_base_dir, 'daisy/config/network.yml')
@@ -273,9 +267,10 @@ def parse_arguments():
confirm_dir_exists(args.storage_dir)
kwargs = {
+ 'labs_dir': args.labs_dir,
'lab_name': args.lab_name,
'pod_name': args.pod_name,
- 'deploy_file': deploy_file,
+ 'src_deploy_file': deploy_file,
'net_file': net_file,
'bin_file': args.bin_file,
'daisy_only': args.daisy_only,
diff --git a/deploy/get_conf.py b/deploy/get_conf.py
index 4d112589..97d2feba 100755
--- a/deploy/get_conf.py
+++ b/deploy/get_conf.py
@@ -46,9 +46,9 @@ def network(network=None):
if net_plane == "TENANT":
net_plane = "physnet1"
network.pop('name')
- map = {}
- map[net_plane] = network
- return map
+ network_map = {}
+ network_map[net_plane] = network
+ return network_map
@decorator_mk('interfaces')
@@ -58,8 +58,8 @@ def interface(interface=None):
net_name = "physnet1"
interface_name = interface.get('interface', '')
map2 = {}
- map = {'ip': '', 'name': net_name}
- map2[interface_name] = [map]
+ interface_map = {'name': net_name}
+ map2[interface_name] = [interface_map]
return map2
@@ -67,25 +67,25 @@ def interface(interface=None):
def role(host=None):
hostname = host.get('name', '')
role = host.get('roles', '')
- map = {}
- map[hostname] = role
- return map
+ role_map = {}
+ role_map[hostname] = role
+ return role_map
@decorator_mk('hosts')
def host(host=None):
hostip = host.get('ip', [])
passwd = host.get('password', [])
- map = {}
- map = {'ip': hostip, 'passwd': passwd}
- return map
+ host_map = {}
+ host_map = {'ip': hostip, 'passwd': passwd}
+ return host_map
@decorator_mk('hosts')
def mac_address(host=None):
mac_addresses = host.get('mac_addresses', [])
- map = {host['name']: mac_addresses}
- return map
+ mac_addr_map = {host['name']: mac_addresses}
+ return mac_addr_map
def network_config_parse(network_data):