mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix up all python3 issues that do not have to do with text/bytes
This commit is contained in:
parent
050d17295d
commit
67ff4428d5
5 changed files with 15 additions and 12 deletions
|
@ -38,6 +38,9 @@ unicode:
|
|||
non_destructive:
|
||||
ansible-playbook non_destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
mine:
|
||||
ansible-playbook mine.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
destructive:
|
||||
ansible-playbook destructive.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ class VaultAES256(object):
|
|||
# 1) nbits (integer) - Length of the counter, in bits.
|
||||
# 2) initial_value (integer) - initial value of the counter. "iv" from gen_key_initctr
|
||||
|
||||
ctr = Counter.new(128, initial_value=long(iv, 16))
|
||||
ctr = Counter.new(128, initial_value=int(iv, 16))
|
||||
|
||||
# AES.new PARAMETERS
|
||||
# 1) AES key, must be either 16, 24, or 32 bytes long -- "key" from gen_key_initctr
|
||||
|
@ -542,7 +542,7 @@ class VaultAES256(object):
|
|||
return None
|
||||
|
||||
# SET THE COUNTER AND THE CIPHER
|
||||
ctr = Counter.new(128, initial_value=long(iv, 16))
|
||||
ctr = Counter.new(128, initial_value=int(iv, 16))
|
||||
cipher = AES.new(key1, AES.MODE_CTR, counter=ctr)
|
||||
|
||||
# DECRYPT PADDED DATA
|
||||
|
|
|
@ -71,7 +71,7 @@ class DataLoader():
|
|||
# if loading JSON failed for any reason, we go ahead
|
||||
# and try to parse it as YAML instead
|
||||
return self._safe_load(data)
|
||||
except YAMLError, yaml_exc:
|
||||
except YAMLError as yaml_exc:
|
||||
self._handle_error(yaml_exc, file_name, show_content)
|
||||
|
||||
def load_from_file(self, file_name):
|
||||
|
|
|
@ -125,7 +125,7 @@ class TestVaultLib(unittest.TestCase):
|
|||
error_hit = False
|
||||
try:
|
||||
enc_data = v.encrypt(data)
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
assert error_hit, "No error was thrown when trying to encrypt data with a header"
|
||||
|
||||
|
@ -137,7 +137,7 @@ class TestVaultLib(unittest.TestCase):
|
|||
error_hit = False
|
||||
try:
|
||||
dec_data = v.decrypt(data)
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
assert error_hit, "No error was thrown when trying to decrypt data without a header"
|
||||
|
||||
|
@ -150,7 +150,7 @@ class TestVaultLib(unittest.TestCase):
|
|||
error_hit = False
|
||||
try:
|
||||
enc_data = v.encrypt(data)
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
assert not error_hit, "An error was thrown when trying to encrypt data without the cipher set"
|
||||
assert v.cipher_name == "AES256", "cipher name is not set to AES256: %s" % v.cipher_name
|
||||
|
|
|
@ -97,9 +97,9 @@ class TestVaultEditor(unittest.TestCase):
|
|||
|
||||
# make sure the password functions for the cipher
|
||||
error_hit = False
|
||||
try:
|
||||
try:
|
||||
ve.decrypt_file()
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
|
||||
# verify decrypted content
|
||||
|
@ -125,9 +125,9 @@ class TestVaultEditor(unittest.TestCase):
|
|||
|
||||
# make sure the password functions for the cipher
|
||||
error_hit = False
|
||||
try:
|
||||
try:
|
||||
ve.decrypt_file()
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
|
||||
# verify decrypted content
|
||||
|
@ -155,7 +155,7 @@ class TestVaultEditor(unittest.TestCase):
|
|||
error_hit = False
|
||||
try:
|
||||
ve.rekey_file('ansible2')
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
|
||||
# verify decrypted content
|
||||
|
@ -171,7 +171,7 @@ class TestVaultEditor(unittest.TestCase):
|
|||
error_hit = False
|
||||
try:
|
||||
dec_data = vl.decrypt(fdata)
|
||||
except errors.AnsibleError, e:
|
||||
except errors.AnsibleError as e:
|
||||
error_hit = True
|
||||
|
||||
os.unlink(v10_file.name)
|
||||
|
|
Loading…
Reference in a new issue