diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 10:38:02 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 10:38:02 -0400 |
commit | d5ef5910898f601e6427c4e34b82a067268010eb (patch) | |
tree | 983f568c6f706c6e75c8ba52b466a442e7735190 /src/sbin | |
parent | 65ca13feeef2f5257135f884ae1433fdbb2220ee (diff) | |
download | bcfg2-d5ef5910898f601e6427c4e34b82a067268010eb.tar.gz bcfg2-d5ef5910898f601e6427c4e34b82a067268010eb.tar.bz2 bcfg2-d5ef5910898f601e6427c4e34b82a067268010eb.zip |
bcfg2-crypt: added --stdout option
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2-crypt | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-crypt b/src/sbin/bcfg2-crypt index a40bab994..cb1b956fb 100755 --- a/src/sbin/bcfg2-crypt +++ b/src/sbin/bcfg2-crypt @@ -321,8 +321,8 @@ def main(): if not setup['args']: print(setup.hm) raise SystemExit(1) - elif setup['encrypt'] and setup['decrypt']: - print("You cannot specify both --encrypt) and --decrypt") + elif setup['encrypt'] and (setup['decrypt_stdout'] or setup['decrypt']): + print("You cannot specify both --encrypt and --decrypt or --stdout") raise SystemExit(1) elif setup['cfg'] and setup['properties']: print("You cannot specify both --cfg and --properties") @@ -375,9 +375,19 @@ def main(): if setup['encrypt']: if not encryptor.encrypt(fname): print("Failed to encrypt %s, skipping" % fname) - elif setup['decrypt']: - if not encryptor.decrypt(fname): + elif setup['decrypt'] or setup['decrypt_stdout']: + data = encryptor.decrypt(fname) + if not data: print("Failed to decrypt %s, skipping" % fname) + continue + if setup['decrypt_stdout']: + if len(setup['args']) > 1: + print("----- %s -----" % fname) + print(data) + if len(setup['args']) > 1: + print("") + else: + encryptor.write_decrypted(fname, data=data) else: logger.info("Neither --encrypt nor --decrypt specified, " "determining mode") |