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
b6de6e69
Commit
b6de6e69
authored
Aug 27, 2015
by
Abhijit Menon-Sen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also support output to stdout with no arguments
This allows "cat plaintext|ansible-vault encrypt > ciphertext".
parent
e7eebb69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lib/ansible/cli/vault.py
+8
-7
No files found.
lib/ansible/cli/vault.py
View file @
b6de6e69
...
@@ -63,21 +63,22 @@ class VaultCLI(CLI):
...
@@ -63,21 +63,22 @@ class VaultCLI(CLI):
self
.
options
,
self
.
args
=
self
.
parser
.
parse_args
()
self
.
options
,
self
.
args
=
self
.
parser
.
parse_args
()
self
.
display
.
verbosity
=
self
.
options
.
verbosity
self
.
display
.
verbosity
=
self
.
options
.
verbosity
if
self
.
options
.
output_file
:
can_output
=
[
'encrypt'
,
'decrypt'
]
if
self
.
action
not
in
[
'encrypt'
,
'decrypt'
]:
raise
AnsibleOptionsError
(
"The --output option can be used only with ansible-vault encrypt/decrypt"
)
if
self
.
action
not
in
can_output
:
if
self
.
options
.
output_file
:
raise
AnsibleOptionsError
(
"The --output option can be used only with ansible-vault
%
s"
%
'/'
.
join
(
can_output
))
if
len
(
self
.
args
)
==
0
:
raise
AnsibleOptionsError
(
"Vault requires at least one filename as a parameter"
)
else
:
# This restriction should remain in place until it's possible to
# This restriction should remain in place until it's possible to
# load multiple YAML records from a single file, or it's too easy
# load multiple YAML records from a single file, or it's too easy
# to create an encrypted file that can't be read back in. But in
# to create an encrypted file that can't be read back in. But in
# the meanwhile, "cat a b c|ansible-vault encrypt --output x" is
# the meanwhile, "cat a b c|ansible-vault encrypt --output x" is
# a workaround.
# a workaround.
if
len
(
self
.
args
)
>
1
:
if
self
.
options
.
output_file
and
len
(
self
.
args
)
>
1
:
raise
AnsibleOptionsError
(
"At most one input file may be used with the --output option"
)
raise
AnsibleOptionsError
(
"At most one input file may be used with the --output option"
)
elif
len
(
self
.
args
)
==
0
:
raise
AnsibleOptionsError
(
"Vault requires at least one filename as a parameter"
)
def
run
(
self
):
def
run
(
self
):
super
(
VaultCLI
,
self
)
.
run
()
super
(
VaultCLI
,
self
)
.
run
()
...
...
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