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
6d8abe84
Commit
6d8abe84
authored
Sep 30, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12572 from amenonsen/vault-pager
Make ansible-vault view not write plaintext to a tempfile
parents
bf06e363
0bb34fd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
16 deletions
+3
-16
lib/ansible/cli/vault.py
+1
-1
lib/ansible/parsing/vault/__init__.py
+2
-15
No files found.
lib/ansible/cli/vault.py
View file @
6d8abe84
...
...
@@ -138,7 +138,7 @@ class VaultCLI(CLI):
def
execute_view
(
self
):
for
f
in
self
.
args
:
self
.
editor
.
view_file
(
f
)
self
.
pager
(
self
.
editor
.
plaintext
(
f
)
)
def
execute_rekey
(
self
):
for
f
in
self
.
args
:
...
...
lib/ansible/parsing/vault/__init__.py
View file @
6d8abe84
...
...
@@ -300,20 +300,14 @@ class VaultEditor:
else
:
self
.
_edit_file_helper
(
filename
,
existing_data
=
plaintext
,
force_save
=
False
)
def
view_file
(
self
,
filename
):
def
plaintext
(
self
,
filename
):
check_prereqs
()
# FIXME: Why write this to a temporary file at all? It would be safer
# to feed it to the PAGER on stdin.
_
,
tmp_path
=
tempfile
.
mkstemp
()
ciphertext
=
self
.
read_data
(
filename
)
plaintext
=
self
.
vault
.
decrypt
(
ciphertext
)
self
.
write_data
(
plaintext
,
tmp_path
)
# drop the user into pager on the tmp file
call
(
self
.
_pager_shell_command
(
tmp_path
))
os
.
remove
(
tmp_path
)
return
plaintext
def
rekey_file
(
self
,
filename
,
new_password
):
...
...
@@ -361,13 +355,6 @@ class VaultEditor:
return
editor
def
_pager_shell_command
(
self
,
filename
):
PAGER
=
os
.
environ
.
get
(
'PAGER'
,
'less'
)
pager
=
shlex
.
split
(
PAGER
)
pager
.
append
(
filename
)
return
pager
class
VaultFile
(
object
):
def
__init__
(
self
,
password
,
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