shelter 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cli/app.rb +24 -13
- data/lib/cli/command/vault.rb +39 -0
- data/lib/cli/helpers/ansible_helper.rb +6 -0
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37a69d30e897ae0af180d9e1d497e1f438f203a
|
4
|
+
data.tar.gz: 939c8be9fd548368e12f87bde474c4b7e6d97d2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18edd440f1d0dd7eaea004731658728dec464076253324517153b8411f629e27ebc704ea63274843649c94b10386e7423df14ca1f992ad7d6b60785ffcc9c242
|
7
|
+
data.tar.gz: f9dd411b674e0848f335d9fbb595660eb417e8419400b951d9f8a203a60b57582ff1b4915a0a658dffaddeff468670864b990bc02955efe5b5c0e44f7403048d
|
data/lib/cli/app.rb
CHANGED
@@ -20,19 +20,30 @@ module Shelter
|
|
20
20
|
block_given? ? yield(@config) : @config
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
if File.directory?(App.config.ansible_directory)
|
24
|
+
register(
|
25
|
+
Shelter::CLI::Command::Ansible,
|
26
|
+
'ansible',
|
27
|
+
'ansible [COMMAND]',
|
28
|
+
'Ansible related commands'
|
29
|
+
)
|
30
|
+
|
31
|
+
register(
|
32
|
+
Shelter::CLI::Command::Vault,
|
33
|
+
'vault',
|
34
|
+
'vault [COMMAND]',
|
35
|
+
'Ansible Vault related commands'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
if File.directory?(App.config.resource_directory)
|
40
|
+
register(
|
41
|
+
Shelter::CLI::Command::Resource,
|
42
|
+
'resource',
|
43
|
+
'resource [COMMAND]',
|
44
|
+
'Resource management'
|
45
|
+
)
|
46
|
+
end
|
36
47
|
|
37
48
|
# Register server managers
|
38
49
|
base_path = File.join(App.config.stack_directory, '*')
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module Shelter
|
6
|
+
module CLI
|
7
|
+
module Command
|
8
|
+
# Ansible vault subcommand for Shelter
|
9
|
+
class Vault < Thor
|
10
|
+
desc 'create NAME', 'create a secret file; Name without extension'
|
11
|
+
def create(file)
|
12
|
+
vault_execute('create', file)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'update NAME', 'update a secret file; Name without extension'
|
16
|
+
def update(file)
|
17
|
+
vault_execute('edit', file)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'view NAME', 'view a secret file; Name without extension'
|
21
|
+
def view(file)
|
22
|
+
vault_execute('view', file)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'list', 'list existsing secret files'
|
26
|
+
def list
|
27
|
+
file_list = Dir["#{App.config.secure_root}/**/*_secret.yaml"]
|
28
|
+
puts file_list.map do |f|
|
29
|
+
" #{f.sub(App.config.secure_root, '').sub('_secret.yaml', '')}"
|
30
|
+
end.join("\n")
|
31
|
+
end
|
32
|
+
|
33
|
+
no_commands do
|
34
|
+
include Shelter::CLI::Helpers::Ansible
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -52,6 +52,12 @@ module Shelter
|
|
52
52
|
full_command = command.join(' ')
|
53
53
|
system full_command
|
54
54
|
end
|
55
|
+
|
56
|
+
def vault_execute(command, file)
|
57
|
+
file = "/#{file}" unless file.start_with?('/')
|
58
|
+
file = "#{App.config.secure_root}#{file}_secret.yaml"
|
59
|
+
system "ansible-vault #{command} #{vault_password_file} #{file}"
|
60
|
+
end
|
55
61
|
end
|
56
62
|
end
|
57
63
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balazs Nadasdi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/cli/app.rb
|
99
99
|
- lib/cli/command/ansible.rb
|
100
100
|
- lib/cli/command/resource.rb
|
101
|
+
- lib/cli/command/vault.rb
|
101
102
|
- lib/cli/helpers/ansible_helper.rb
|
102
103
|
- lib/cli/helpers/cloudformation_helper.rb
|
103
104
|
- lib/cli/stack/cloud_formation.rb
|