Module: Balmora::Extension::FileSecret
- Defined in:
- lib/balmora/extension/file_secret.rb
Instance Method Summary collapse
- #_copy_file ⇒ Object
- #_decrypt ⇒ Object
- #_encrypt ⇒ Object
- #_source_contents ⇒ Object
- #_target_contents ⇒ Object
- #options ⇒ Object
Instance Method Details
#_copy_file ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/balmora/extension/file_secret.rb', line 7 def _copy_file() if @action == 'pull' @shell.run!(_source_contents() + [_expr('|'), *@shell.sudo(), 'tee', _target_path()], change: true) else @shell.run!(['cat', _source_path(), _expr('|'), *_encrypt(), _expr('|'), *@shell.sudo(), 'tee', _target_path()], change: true) end end |
#_decrypt ⇒ Object
37 38 39 |
# File 'lib/balmora/extension/file_secret.rb', line 37 def _decrypt() return ['openssl', 'enc', '-aes-256-cbc', '-d', '-pass', option(:password)] end |
#_encrypt ⇒ Object
41 42 43 |
# File 'lib/balmora/extension/file_secret.rb', line 41 def _encrypt() return ['openssl', 'enc', '-aes-256-cbc', '-e', '-pass', option(:password)] end |
#_source_contents ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/balmora/extension/file_secret.rb', line 17 def _source_contents() command = super() if @action == 'pull' command += [_expr('|')] + _decrypt() end return command end |
#_target_contents ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/balmora/extension/file_secret.rb', line 27 def _target_contents() command = super() if @action == 'push' command += [_expr('|')] + _decrypt() end return command end |
#options ⇒ Object
3 4 5 |
# File 'lib/balmora/extension/file_secret.rb', line 3 def () return super() + [:password] end |