2
0
mirror of https://opendev.org/x/pyghmi synced 2026-08-28 09:36:43 +00:00

urlencode was not properly imported for py2/py3

This function move was not accomodated everywhere.

Change-Id: I31839b84e750b0fc25a379db640193366a14c8c4
This commit is contained in:
Jarrod Johnson
2019-12-12 10:01:05 -05:00
parent 14cefc6502
commit a1fe180e04
3 changed files with 20 additions and 11 deletions
+5 -2
View File
@@ -17,7 +17,10 @@
import base64
import binascii
import traceback
import urllib
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
import pyghmi.constants as pygconst
import pyghmi.exceptions as pygexc
@@ -739,7 +742,7 @@ class OEMHandler(generic.OEMHandler):
conn = wc.SecureHTTPConnection(bmc, 443,
verifycallback=self.ipmicmd.certverify)
conn.connect()
params = urllib.urlencode({
params = urlencode({
'WEBVAR_USERNAME': username,
'WEBVAR_PASSWORD': password
})
+10 -7
View File
@@ -37,7 +37,10 @@ import random
import re
import socket
import struct
import urllib
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
import weakref
@@ -319,10 +322,10 @@ class IMMClient(object):
if se.errno != errno.ECONNREFUSED:
raise
return None
adata = urllib.urlencode({'user': self.username,
'password': self.password,
'SessionTimeout': 60
})
adata = urlencode({'user': self.username,
'password': self.password,
'SessionTimeout': 60
})
headers = {'Connection': 'keep-alive',
'Referer': 'https://{0}/designs/imm/index.php'.format(
self.imm),
@@ -425,7 +428,7 @@ class IMMClient(object):
def attach_remote_media(self, url, user, password):
url = url.replace(':', '\:')
params = urllib.urlencode({
params = urlencode({
'RP_VmAllocateMountUrl({0},{1},1,,)'.format(
self.username, url): ''
})
@@ -464,7 +467,7 @@ class IMMClient(object):
uload['slotId']))
for url in removeurls:
url = url.replace(':', '\:')
params = urllib.urlencode({
params = urlencode({
'RP_VmAllocateUnMountUrl({0},{1},0,)'.format(
self.username, url): ''})
result = self.wc.grab_json_response('/data?set', params,
+5 -2
View File
@@ -20,7 +20,10 @@ import pyghmi.ipmi.private.session as ipmisession
import pyghmi.ipmi.sdr as sdr
import pyghmi.util.webclient as webclient
import struct
import urllib
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
import weakref
from xml.etree.ElementTree import fromstring
import zipfile
@@ -386,7 +389,7 @@ class SMMClient(object):
cv = self.ipmicmd.certverify
wc = webclient.SecureHTTPConnection(self.smm, 443, verifycallback=cv)
wc.connect()
loginform = urllib.urlencode({'user': self.username,
loginform = urlencode({'user': self.username,
'password': self.password})
wc.request('POST', '/data/login', loginform)
rsp = wc.getresponse()