Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b8f627d1
Commit
b8f627d1
authored
Mar 19, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent rewriting the encrypted file if decryption fails
parent
e71857fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
lib/ansible/utils/vault.py
+6
-2
No files found.
lib/ansible/utils/vault.py
View file @
b8f627d1
...
...
@@ -113,7 +113,6 @@ class VaultLib(object):
# clean out header
data
=
self
.
_split_header
(
data
)
# create the cipher object
if
'Vault'
+
self
.
cipher_name
in
globals
()
and
self
.
cipher_name
in
CIPHER_WHITELIST
:
cipher
=
globals
()[
'Vault'
+
self
.
cipher_name
]
...
...
@@ -123,6 +122,8 @@ class VaultLib(object):
# try to unencrypt data
data
=
this_cipher
.
decrypt
(
data
,
self
.
password
)
if
not
data
:
raise
errors
.
AnsibleError
(
"Decryption failed"
)
return
data
...
...
@@ -209,7 +210,10 @@ class VaultEditor(object):
this_vault
=
VaultLib
(
self
.
password
)
if
this_vault
.
is_encrypted
(
tmpdata
):
dec_data
=
this_vault
.
decrypt
(
tmpdata
)
self
.
write_data
(
dec_data
,
self
.
filename
)
if
not
dec_data
:
raise
errors
.
AnsibleError
(
"Decryption failed"
)
else
:
self
.
write_data
(
dec_data
,
self
.
filename
)
else
:
raise
errors
.
AnsibleError
(
"
%
s is not encrypted"
%
self
.
filename
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment