Added data to deploy cast from backend
This commit is contained in:
parent
5442579274
commit
1c75add9d4
@ -284,11 +284,18 @@ class ClusterChangesHandler(JSONHandler):
|
|||||||
)
|
)
|
||||||
nd.power_reboot()
|
nd.power_reboot()
|
||||||
|
|
||||||
message = {"method": "deploy", "args": {"var1": "Hello from nailgun"}}
|
|
||||||
rpc.cast('mcollective', message)
|
|
||||||
|
|
||||||
netmanager.assign_ips(cluster_id, "management")
|
netmanager.assign_ips(cluster_id, "management")
|
||||||
|
|
||||||
|
nodes = []
|
||||||
|
for n in cluster.nodes:
|
||||||
|
nodes.append({'id': n.id, 'status': n.status,
|
||||||
|
'ip': n.ip, 'mac': n.mac, 'role': n.role,
|
||||||
|
'network_data': netmanager.get_node_networks(n.id)})
|
||||||
|
message = {'method': 'deploy',
|
||||||
|
'respond_to': 'deploy_resp',
|
||||||
|
'args': {'nodes': nodes}}
|
||||||
|
rpc.cast('naily', message)
|
||||||
|
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
self.render(cluster),
|
self.render(cluster),
|
||||||
indent=4
|
indent=4
|
||||||
|
@ -48,3 +48,17 @@ def assign_ips(cluster_id, network_name):
|
|||||||
web.ctx.orm.add(ip_db)
|
web.ctx.orm.add(ip_db)
|
||||||
web.ctx.orm.commit()
|
web.ctx.orm.commit()
|
||||||
used_ips.append(free_ip)
|
used_ips.append(free_ip)
|
||||||
|
|
||||||
|
|
||||||
|
def get_node_networks(node_id):
|
||||||
|
ips = web.ctx.orm.query(IPAddr).filter_by(node=node_id).all()
|
||||||
|
network_data = []
|
||||||
|
for i in ips:
|
||||||
|
net = web.ctx.orm.query(Network).get(i.network)
|
||||||
|
network_data.append({
|
||||||
|
'vlan': net.vlan_id,
|
||||||
|
'ip': i.ip_addr + '/' + str(IPNetwork(net.cidr).prefixlen),
|
||||||
|
'brd': str(IPNetwork(net.cidr).broadcast),
|
||||||
|
'gateway': net.gateway,
|
||||||
|
'dev': 'eth0'}) # We need to figure out interface
|
||||||
|
return network_data
|
||||||
|
Loading…
Reference in New Issue
Block a user