Skip to content

Commit 8d74a98

Browse files
authored
Replace more leftover occurrences of semi-colons as URL query arg separators (#432)
* Follow-up for #431 to replace more leftover occurences of semi-colons as url query arg separator. Found by manually inspecting the output of `codegrep.py ';'` with filtering of various comment, javascript, css, and shell use cases. * Replace legacy `md5` lib use with our `make_simple_hash` helper, which does the same on py3 while also automatically taking care of byte vs str issues.
1 parent ff6ff43 commit 8d74a98

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

mig/shared/vms.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
3-
43
#
54
# --- BEGIN_HEADER ---
65
#
76
# vms - shared virtual machine functions
8-
#
9-
# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter
7+
# Copyright (C) 2003-2026 The MiG Project by the Science HPC Center at UCPH
108
#
119
# This file is part of MiG.
1210
#
@@ -22,7 +20,8 @@
2220
#
2321
# You should have received a copy of the GNU General Public License
2422
# along with this program; if not, write to the Free Software
25-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24+
# USA.
2625
#
2726
# -- END_HEADER ---
2827
#
@@ -41,7 +40,6 @@
4140
from past.builtins import basestring
4241
import datetime
4342
import configparser
44-
import md5
4543
import operator
4644
import os
4745
import shutil
@@ -52,6 +50,7 @@
5250
from mig.shared.defaults import any_vgrid
5351
from mig.shared.fileio import unpickle, remove_rec
5452
from mig.shared.job import new_job
53+
from mig.shared.pwcrypto import make_simple_hash
5554

5655
sys_location = 'sys_location.txt'
5756
vm_base = 'vms'
@@ -121,7 +120,7 @@ def vnc_jobid(job_id='Unknown'):
121120
This methods provides 127^8 identifiers.
122121
"""
123122

124-
job_id_digest = md5.new(job_id).hexdigest()[:16] # 2
123+
job_id_digest = make_simple_hash(job_id)[:16] # 2
125124
password = ''
126125
for i in range(0, len(job_id_digest), 2): # 3, 4
127126

@@ -327,14 +326,14 @@ def machine_link(
327326

328327
# Canceled, Finished, Unknown
329328

330-
specs_string = 'action=start;machine_name=%s' % name
329+
specs_string = 'action=start&machine_name=%s' % name
331330
for (key, val) in machine_req.items():
332331
# Lists of strings must be split into multiple key=val pairs
333332
if not isinstance(val, basestring) and isinstance(val, list):
334333
for entry in val:
335-
specs_string += ';%s=%s' % (key, entry)
334+
specs_string += '&%s=%s' % (key, entry)
336335
else:
337-
specs_string += ';%s=%s' % (key, val)
336+
specs_string += '&%s=%s' % (key, val)
338337
link = '<a href="?%s">%s</a>' % (specs_string, content)
339338

340339
return link

0 commit comments

Comments
 (0)