Skip to content

Commit e1a7522

Browse files
Check whether scriptsVhostPoolUserSelectable is TRUE and allow changing $locker.scripts.mit.edu pool but not path.
1 parent 4ba5dab commit e1a7522

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

scriptspony/templates/edit.mak

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ from scripts.auth import token
1010
<ul>
1111
<li>Hostname: ${hostname}</li>
1212
<li>Locker: ${locker}</li>
13+
%if hostname not in [locker + '.scripts.mit.edu']:
1314
<li>Path: /mit/${locker}/web_scripts/<input type="text" name="path" value="${path}" /></li>
14-
<li>Server Pool: ${pool} <select name="pool">
15+
%endif
16+
<li>Server Pool: ${pool["description"]} <select name="pool">
1517
<option value="unchanged">Unchanged</option>
1618
<option value="default">Default</option>
17-
%for ip, description in pools.items():
18-
<option value="${ip}">${description}</option>
19+
%for ip, info in pools.items():
20+
%if info["scriptsVhostPoolUserSelectable"] == "TRUE":
21+
<option value="${ip}">${info["description"]}</option>
22+
%endif
1923
%endfor
2024
</select></li>
2125
</ul>

scriptspony/templates/index.mak

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ from scripts import auth
2222
<small>/mit/${locker}/web_scripts/</small>${path}
2323
</td>
2424
<td>
25-
<big>${pool}</big>
25+
${pool["description"]}
2626
</td>
27-
%if host not in (locker+'.scripts.mit.edu',):
2827
<td class="nbr">
2928
<a href="${tg.url('/edit/'+locker+'/'+host)}" class="btn sm-btn" aria-label="Edit"><span class="fa fa-pencil" aria-hidden="true"></span></a>
3029
%if host.lower().endswith('.'+locker+'.scripts.mit.edu') or not host.lower().endswith('.mit.edu'):
3130
<a href="${tg.url('/delete/'+locker+'/'+host)}" class="btn btn-danger sm-btn" aria-label="Delete"><span class="fa fa-times-circle" aria-hidden="true"></span></a>
3231
%endif
3332
</td>
34-
%else:
35-
<td><span class="edit-btn-disabled"><span class="fa fa-ban"></span></span></td>
36-
%endif
3733
</tr>
3834
%endfor
3935
</table>

scriptspony/vhosts.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def list_pools():
8585
"ou=Pools,dc=scripts,dc=mit,dc=edu",
8686
ldap.SCOPE_ONELEVEL,
8787
"objectClass=scriptsVhostPool",
88-
["scriptsVhostPoolIPv4", "description"],
88+
["scriptsVhostPoolIPv4", "description", "scriptsVhostPoolUserSelectable"],
8989
)
9090
return {
91-
m["scriptsVhostPoolIPv4"][0]: m["description"][0]
91+
m["scriptsVhostPoolIPv4"][0]: {"description": m["description"][0], "scriptsVhostPoolUserSelectable": m["scriptsVhostPoolUserSelectable"][0]}
9292
for _, m in res
9393
}
9494

@@ -156,8 +156,6 @@ def set_path(locker, vhost, path):
156156
@reconnecting
157157
def set_pool(locker, vhost, pool):
158158
"""Sets the pool of an existing vhost owned by the locker."""
159-
if vhost == locker + ".scripts.mit.edu":
160-
raise UserError("You cannot reconfigure " + vhost + "!")
161159
locker = locker.encode("utf-8")
162160
pool = pool.encode("utf-8")
163161
scriptsVhostName = get_vhost_name(locker, vhost)

0 commit comments

Comments
 (0)