This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new 897dad619b8 marvin: replace encodestring for encodebytes (#7027)
897dad619b8 is described below
commit 897dad619b88bb853d41686bc5aeaf8af5e9bc49
Author: dahn <[email protected]>
AuthorDate: Mon May 8 09:21:12 2023 +0200
marvin: replace encodestring for encodebytes (#7027)
Fixes: #6962
---
test/integration/component/test_configdrive.py | 2 +-
test/integration/component/test_deploy_vm_userdata_multi_nic.py | 2 +-
test/integration/component/test_deploy_vm_userdata_reg.py | 2 +-
tools/marvin/marvin/cloudstackConnection.py | 2 +-
tools/ngui/requester.py | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/integration/component/test_configdrive.py
b/test/integration/component/test_configdrive.py
index b8ce4bdde5b..38e753480db 100644
--- a/test/integration/component/test_configdrive.py
+++ b/test/integration/component/test_configdrive.py
@@ -1025,7 +1025,7 @@ class ConfigDriveUtils:
:rtype: str
"""
self.debug("Updating userdata for VM - %s" % vm.name)
- updated_user_data =
base64.encodestring(new_user_data.encode()).decode()
+ updated_user_data = base64.encodebytes(new_user_data.encode()).decode()
with self.stopped_vm(vm):
vm.update(self.api_client, userdata=updated_user_data)
diff --git a/test/integration/component/test_deploy_vm_userdata_multi_nic.py
b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
index 2f1f256399d..766c96ac119 100644
--- a/test/integration/component/test_deploy_vm_userdata_multi_nic.py
+++ b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
@@ -126,7 +126,7 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
"""Test userdata update when non default nic is without userdata for
deploy and update
"""
- self.userdata = base64.encodestring(self.userdata.encode()).decode()
+ self.userdata = base64.encodebytes(self.userdata.encode()).decode()
network1 = Network.create(
self.apiclient,
diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py
b/test/integration/component/test_deploy_vm_userdata_reg.py
index a6e3c178286..9ac0ff00eb6 100644
--- a/test/integration/component/test_deploy_vm_userdata_reg.py
+++ b/test/integration/component/test_deploy_vm_userdata_reg.py
@@ -99,7 +99,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
# py2 didn't insert any new-lines
# so we now do the encoding in the stored userdata string and remove
the '\n's
# to get a good easy string compare in the assert later on.
- cls.userdata =
base64.encodestring(cls.userdata.encode()).decode().replace('\n', '')
+ cls.userdata =
base64.encodebytes(cls.userdata.encode()).decode().replace('\n', '')
cls.user_data_2k= ''.join(random.choice(string.ascii_uppercase +
string.digits) for x in range(2000))
cls.user_data_2kl = ''.join(random.choice(string.ascii_uppercase +
string.digits) for x in range(1900))
diff --git a/tools/marvin/marvin/cloudstackConnection.py
b/tools/marvin/marvin/cloudstackConnection.py
index c5cbb18dc9e..5b438daceb7 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -147,7 +147,7 @@ class CSConnection(object):
).replace("+", "%20")]
) for r in params]
)
- signature = base64.encodestring(
+ signature = base64.encodebytes(
hmac.new(self.securityKey.encode('utf-8'),
hash_str.encode('utf-8'),
hashlib.sha1).digest()).strip()
diff --git a/tools/ngui/requester.py b/tools/ngui/requester.py
index 3f3337d3b4e..03342dfa58d 100644
--- a/tools/ngui/requester.py
+++ b/tools/ngui/requester.py
@@ -68,7 +68,7 @@ def make_request(command, args, logger, host, port,
str.lower(urllib.quote_plus(str(r[1]))).replace("+",
"%20")]) for r in request])
- sig = urllib.quote_plus(base64.encodestring(hmac.new(secretkey, hashStr,
+ sig = urllib.quote_plus(base64.encodebytes(hmac.new(secretkey, hashStr,
hashlib.sha1).digest()).strip())
request_url += "&signature=%s" % sig
request_url = "%s://%s:%s%s?%s" % (protocol, host, port, path, request_url)