Skip to content

Commit

Permalink
Merge "Revert "Executing prov_role_node task serailly""
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 11, 2015
2 parents ed77fc6 + 2e49d89 commit e2b0ada
Showing 1 changed file with 50 additions and 44 deletions.
94 changes: 50 additions & 44 deletions fabfile/tasks/provision.py
Expand Up @@ -1248,65 +1248,71 @@ def prov_config_node():
#end prov_config_node

@task
@hosts(env.roledefs['cfgm'][:1])
@EXECUTE_TASK
@roles('database')
def prov_database_node():
cfgm_host = get_control_host_string(env.host_string)
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = hstr_to_ip(cfgm_host)
for database_host in env.roledefs['database']:
tgt_ip = hstr_to_ip(get_control_host_string(database_host))
tgt_hostname = sudo("hostname")
cfgm_host_password = get_env_passwords(env.roledefs['cfgm'][0])
tgt_ip = hstr_to_ip(get_control_host_string(env.host_string))
tgt_hostname = sudo("hostname")

with cd(UTILS_DIR):
cmd = "python provision_database_node.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
cmd += " %s" % get_mt_opts()
sudo(cmd)
with settings(cd(UTILS_DIR), host_string=cfgm_host,
password=cfgm_host_password):
cmd = "python provision_database_node.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
cmd += " %s" % get_mt_opts()
sudo(cmd)
#end prov_database_node

@task
@hosts(env.roledefs['cfgm'][:1])
@EXECUTE_TASK
@roles('collector')
def prov_analytics_node():
cfgm_host = get_control_host_string(env.host_string)
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = hstr_to_ip(cfgm_host)
for collector_host in env.roledefs['collector']:
tgt_ip = hstr_to_ip(get_control_host_string(collector_host))
tgt_hostname = sudo("hostname")
cfgm_host_password = get_env_passwords(env.roledefs['cfgm'][0])
tgt_ip = hstr_to_ip(get_control_host_string(env.host_string))
tgt_hostname = sudo("hostname")

with cd(UTILS_DIR):
cmd = "python provision_analytics_node.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
cmd += " %s" % get_mt_opts()
sudo(cmd)
with settings(cd(UTILS_DIR), host_string=cfgm_host,
password=cfgm_host_password):
cmd = "python provision_analytics_node.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
cmd += " %s" % get_mt_opts()
sudo(cmd)
#end prov_analytics_node

@task
@hosts(env.roledefs['cfgm'][:1])
@EXECUTE_TASK
@roles('control')
def prov_control_bgp():
cfgm_host = get_control_host_string(env.host_string)
cfgm_host = get_control_host_string(env.roledefs['cfgm'][0])
cfgm_ip = hstr_to_ip(cfgm_host)
for control_host in env.roledefs['control']:
tgt_ip = hstr_to_ip(get_control_host_string(control_host))
tgt_hostname = sudo("hostname")
cfgm_host_password = get_env_passwords(env.roledefs['cfgm'][0])
tgt_ip = hstr_to_ip(get_control_host_string(env.host_string))
tgt_hostname = sudo("hostname")

with cd(UTILS_DIR):
print "Configuring global system config with the ASN"
cmd = "python provision_control.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --api_server_port 8082"
cmd += " --router_asn %s" % testbed.router_asn
cmd += " %s" % get_mt_opts()
sudo(cmd)
print "Adding control node as bgp router"
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
sudo(cmd)
with settings(cd(UTILS_DIR), host_string=cfgm_host,
password=cfgm_host_password):
print "Configuring global system config with the ASN"
cmd = "python provision_control.py"
cmd += " --api_server_ip %s" % cfgm_ip
cmd += " --api_server_port 8082"
cmd += " --router_asn %s" % testbed.router_asn
cmd += " %s" % get_mt_opts()
sudo(cmd)
print "Adding control node as bgp router"
cmd += " --host_name %s" % tgt_hostname
cmd += " --host_ip %s" % tgt_ip
cmd += " --oper add"
sudo(cmd)
#end prov_control_bgp

@roles('cfgm')
Expand Down

0 comments on commit e2b0ada

Please sign in to comment.