aboutsummaryrefslogtreecommitdiff
blob: 890cbceaa7668cca019390100387a2982016c792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<? include /main_top.pyhtml ?>
<?
errormsg = ""
if post_params:
	if not post_params['hostname']:
		errormsg += "You didn't give a hostname!<br>"
	elif not (post_params['current_ip'] or post_params['current_dhcp'] or post_params['current_netup']):
		errormsg += "You must specify an IP address or DHCP!<br>"
	elif not post_params['mac']:
		errormsg += "You must specify the mac address of the client!<br>"
	else:
		for client in shared_info.clients:
			if post_params['mac'] == client['mac']:
				errormsg = "That client already exists!"
		if not errormsg:
			try:
				new_client = {}
				new_client['hostname'] = post_params['hostname']
				new_client['mac'] = post_params['mac']
				if post_params['current_netup']:
					new_client['current_ip'] = "None"
				elif post_params['current_dhcp']:
					new_client['current_ip'] = "dhcp"
				else:
					new_client['current_ip'] = post_params['current_ip']
				if post_params['profile']:
					new_client['profile'] = post_params['profile']
				if post_params['post_dhcp']:
					new_client['post_ip'] = "dhcp"
				elif post_params['post_ip']:
					new_client['post_ip'] = post_params['post_ip']
				new_client['status'] = "Not Installed"
				if not post_params['mac'] in shared_info.client_state:
					shared_info.client_state[new_client['mac']] = { 'ip': new_client['current_ip'], 'install_status': "waiting for server", 'start_install': False }
				shared_info.clients.append(new_client)
			except:
				errormsg += "Error while adding the new client!"
	if not errormsg:
		errormsg = "Client added successfully"

?>
<: if errormsg:
<br><% errormsg %><br><br>
:>
<h2>Add Client:</h2>
<br>
Note, all clients will first start with the start_install flag unset.  You must use the Execute
step to deploy all installations.
<form action="/add_client.pyhtml" method="POST" enctype="multipart/form-data">
Hostname: <input type="text" name="hostname"><br>
MAC Address: <input type="text" name="mac" maxlength="18"><br>
Current IP: <input type="text" name="current_ip" maxlength="15"> --- or <input type="checkbox" name="current_dhcp"> DHCP --- or <input type="checkbox" name="current_netup"> None (client is already up and connected to the net)<br>
Profile to be used by this client: <select name="profile">
<: for profile in shared_info.profiles:
<option value="<% profile['name'] %>"><% profile['name'] %></option>
</select><br><hr>
Post-install settings:
Post-install network IP: <input type="text" name="post_ip" maxlength="15"> 
blah blah netmask gateway blah.
--- or <input type="checkbox" name="post_dhcp"> DHCP.

<input type="submit" name="addclient" value="Add Client">
</form>

<? include /main_bottom.pyhtml ?>