wombat-cli 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.travis.yml +27 -0
- data/CHANGELOG.md +15 -1
- data/Gemfile +3 -0
- data/README.md +2 -2
- data/Rakefile +25 -0
- data/bin/wombat +1 -1
- data/generator_files/cookbooks/automate/metadata.rb +1 -1
- data/generator_files/cookbooks/automate/recipes/update-users.rb +1 -1
- data/generator_files/cookbooks/chef_server/recipes/default.rb +24 -11
- data/generator_files/cookbooks/workstation/.kitchen.ec2.yml +2 -1
- data/generator_files/cookbooks/workstation/metadata.rb +1 -1
- data/generator_files/cookbooks/workstation/recipes/default.rb +1 -2
- data/generator_files/cookbooks/workstation/templates/default/ise_profile.ps1.erb +2 -2
- data/generator_files/cookbooks/workstation/test/integration/default/workstation_spec.rb +4 -4
- data/generator_files/packer/automate.json +129 -107
- data/generator_files/packer/build-node.json +134 -112
- data/generator_files/packer/chef-server.json +130 -108
- data/generator_files/packer/compliance.json +126 -104
- data/generator_files/packer/infranodes-windows.json +136 -97
- data/generator_files/packer/infranodes.json +127 -106
- data/generator_files/packer/workstation.json +134 -95
- data/generator_files/templates/arm.json.erb +576 -0
- data/generator_files/wombat.yml +6 -2
- data/lib/wombat/aws.rb +67 -0
- data/lib/wombat/build.rb +273 -184
- data/lib/wombat/cli.rb +182 -147
- data/lib/wombat/common.rb +228 -220
- data/lib/wombat/crypto.rb +65 -0
- data/lib/wombat/delete.rb +48 -18
- data/lib/wombat/deploy.rb +147 -34
- data/lib/wombat/init.rb +21 -19
- data/lib/wombat/latest.rb +27 -0
- data/lib/wombat/output.rb +31 -30
- data/lib/wombat/update.rb +13 -10
- data/lib/wombat/version.rb +1 -1
- data/spec/functional/common_spec.rb +26 -0
- data/spec/spec_helper.rb +103 -0
- data/spec/unit/common_spec.rb +116 -0
- data/wombat-cli.gemspec +2 -1
- metadata +36 -11
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{delivery.crt → automate.crt} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{delivery.key → automate.key} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{chef-server.crt → chef.crt} +0 -0
- /data/generator_files/cookbooks/workstation/test/fixtures/cookbooks/mock_data/files/{chef-server.key → chef.key} +0 -0
data/lib/wombat/cli.rb
CHANGED
@@ -9,182 +9,217 @@ require 'wombat/output'
|
|
9
9
|
require 'wombat/delete'
|
10
10
|
require 'wombat/update'
|
11
11
|
require 'wombat/init'
|
12
|
+
require 'wombat/latest'
|
13
|
+
|
14
|
+
module Wombat
|
15
|
+
class Options
|
16
|
+
|
17
|
+
NAME = File.basename($0).freeze
|
18
|
+
|
19
|
+
def self.parse(args)
|
20
|
+
options = OpenStruct.new
|
21
|
+
|
22
|
+
global = OptionParser.new do |opts|
|
23
|
+
opts.banner = "Usage: #{NAME} [SUBCOMMAND [options]]"
|
24
|
+
opts.separator ""
|
25
|
+
opts.version = Wombat::VERSION
|
26
|
+
opts.separator <<-COMMANDS.gsub(/^ {8}/, "")
|
27
|
+
build : build one or more templates
|
28
|
+
delete : delete a stack
|
29
|
+
deploy : deploy a stack
|
30
|
+
help : prints this help message
|
31
|
+
init : create wombat skeleton project
|
32
|
+
list : list all templates in project
|
33
|
+
outputs : get outputs for a stack
|
34
|
+
latest : search for latest images
|
35
|
+
update : update lock and/or cloud template
|
36
|
+
COMMANDS
|
37
|
+
end
|
12
38
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def self.parse(args)
|
18
|
-
options = OpenStruct.new
|
19
|
-
|
20
|
-
global = OptionParser.new do |opts|
|
21
|
-
opts.banner = "Usage: #{NAME} [SUBCOMMAND [options]]"
|
22
|
-
opts.separator ""
|
23
|
-
opts.version = Wombat::VERSION
|
24
|
-
opts.separator <<-COMMANDS.gsub(/^ {8}/, "")
|
25
|
-
build : build one or more templates
|
26
|
-
delete : delete a stack
|
27
|
-
deploy : deploy a stack
|
28
|
-
help : prints this help message
|
29
|
-
init : create wombat skeleton project
|
30
|
-
list : list all templates in project
|
31
|
-
outputs : get outputs for a stack
|
32
|
-
update : update lock and/or cloud template
|
33
|
-
COMMANDS
|
34
|
-
end
|
35
|
-
|
36
|
-
templates_argv_proc = proc { |options|
|
37
|
-
options.templates = ARGV unless args.empty?
|
38
|
-
}
|
39
|
-
|
40
|
-
box_version_argv_proc = proc { |options|
|
41
|
-
options.box = ARGV[0]
|
42
|
-
options.version = ARGV[1]
|
43
|
-
}
|
44
|
-
|
45
|
-
stack_argv_proc = proc { |options|
|
46
|
-
options.stack = ARGV[0]
|
47
|
-
}
|
39
|
+
templates_argv_proc = proc { |options|
|
40
|
+
options.templates = ARGV unless args.empty?
|
41
|
+
}
|
48
42
|
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
box_version_argv_proc = proc { |options|
|
44
|
+
options.box = ARGV[0]
|
45
|
+
options.version = ARGV[1]
|
46
|
+
}
|
52
47
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
parser: OptionParser.new { |opts|
|
57
|
-
opts.banner = "Usage: #{NAME} build [options] TEMPLATE[ TEMPLATE ...]"
|
48
|
+
stack_argv_proc = proc { |options|
|
49
|
+
options.stack = ARGV[0]
|
50
|
+
}
|
58
51
|
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
file_argv_proc = proc { |options|
|
53
|
+
options.file = ARGV[0]
|
54
|
+
}
|
62
55
|
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
subcommand = {
|
57
|
+
build: {
|
58
|
+
class: BuildRunner,
|
59
|
+
parser: OptionParser.new { |opts|
|
60
|
+
opts.banner = "Usage: #{NAME} build [options] TEMPLATE[ TEMPLATE ...]"
|
61
|
+
|
62
|
+
opts.on("-o BUILDER", "--only BUILDER", 'Only build the builds with the given comma-separated names') do |opt|
|
63
|
+
options.builder = opt
|
64
|
+
end
|
65
|
+
|
66
|
+
opts.on("--parallel", "Build in parallel") do |opt|
|
67
|
+
options.parallel = opt
|
68
|
+
end
|
69
|
+
|
70
|
+
opts.on("-c CONFIG", "--config CONFIG", "Specify a different yaml config (default is wombat.yml)") do |opt|
|
71
|
+
options.wombat_yml = opt
|
72
|
+
end
|
73
|
+
|
74
|
+
opts.on("--debug", "Run in debug mode.") do |opt|
|
75
|
+
options.debug = opt
|
76
|
+
end
|
77
|
+
|
78
|
+
opts.on("--novendorcookbooks", "Do not vendor cookbooks") do |opt|
|
79
|
+
options.vendor = opt
|
80
|
+
end
|
81
|
+
},
|
82
|
+
argv: templates_argv_proc
|
66
83
|
},
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
84
|
+
delete: {
|
85
|
+
class: DeleteRunner,
|
86
|
+
parser: OptionParser.new { |opts|
|
87
|
+
opts.banner = "Usage: #{NAME} delete STACK"
|
88
|
+
|
89
|
+
opts.on("-c CLOUD", "--cloud CLOUD", "Select cloud") do |opt|
|
90
|
+
options.cloud = opt
|
91
|
+
end
|
92
|
+
},
|
93
|
+
argv: stack_argv_proc
|
77
94
|
},
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
95
|
+
deploy: {
|
96
|
+
class: DeployRunner,
|
97
|
+
parser: OptionParser.new { |opts|
|
98
|
+
opts.banner = "Usage: #{NAME} deploy STACK"
|
99
|
+
|
100
|
+
opts.on("-c CLOUD", "--cloud CLOUD", "Select cloud") do |opt|
|
101
|
+
options.cloud = opt
|
102
|
+
end
|
103
|
+
|
104
|
+
opts.on("--update-lock", "Update lockfile") do |opt|
|
105
|
+
options.update_lock = opt
|
106
|
+
end
|
107
|
+
|
108
|
+
opts.on("--update-template", "Update template") do |opt|
|
109
|
+
options.update_template = opt
|
110
|
+
end
|
111
|
+
|
112
|
+
opts.on("--async", "Deploy stack asynchronously, e.g. do not block command line. Only applies to Azure deployments.") do |opt|
|
113
|
+
options.azure_async = opt
|
114
|
+
end
|
115
|
+
},
|
116
|
+
argv: stack_argv_proc
|
96
117
|
},
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
exit(0)
|
104
|
-
}
|
105
|
-
},
|
106
|
-
init: {
|
107
|
-
class: InitRunner,
|
108
|
-
parser: OptionParser.new { |opts|
|
109
|
-
opts.banner = "Usage: #{NAME} init"
|
110
|
-
|
111
|
-
opts.on("-p PATH", "--path PATH", "Path to copy skeleton") do |opt|
|
112
|
-
options.path = opt
|
113
|
-
end
|
118
|
+
help: {
|
119
|
+
parser: OptionParser.new {},
|
120
|
+
argv: proc { |options|
|
121
|
+
puts global
|
122
|
+
exit(0)
|
123
|
+
}
|
114
124
|
},
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
125
|
+
init: {
|
126
|
+
class: InitRunner,
|
127
|
+
parser: OptionParser.new { |opts|
|
128
|
+
opts.banner = "Usage: #{NAME} init"
|
129
|
+
|
130
|
+
opts.on("-p PATH", "--path PATH", "Path to copy skeleton") do |opt|
|
131
|
+
options.path = opt
|
132
|
+
end
|
133
|
+
},
|
134
|
+
argv: stack_argv_proc
|
121
135
|
},
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
136
|
+
list: {
|
137
|
+
class: ListRunner,
|
138
|
+
parser: OptionParser.new { |opts|
|
139
|
+
opts.banner = "Usage: #{NAME} list [TEMPLATE ...]"
|
140
|
+
},
|
141
|
+
argv: templates_argv_proc
|
128
142
|
},
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
opts.on("-c CLOUD", "--cloud CLOUD", "Select cloud") do |opt|
|
137
|
-
options.cloud = opt
|
138
|
-
end
|
143
|
+
outputs: {
|
144
|
+
class: OutputRunner,
|
145
|
+
parser: OptionParser.new { |opts|
|
146
|
+
opts.banner = "Usage: #{NAME} outputs [TEMPLATE ...]"
|
147
|
+
},
|
148
|
+
argv: stack_argv_proc
|
139
149
|
},
|
140
|
-
|
150
|
+
latest: {
|
151
|
+
class: LatestRunner,
|
152
|
+
parser: OptionParser.new { |opts|
|
153
|
+
opts.banner = "Usage: #{NAME} search"
|
154
|
+
|
155
|
+
opts.on("-c CLOUD", "--cloud CLOUD", "Select cloud") do |opt|
|
156
|
+
options.cloud = opt
|
157
|
+
end
|
158
|
+
},
|
159
|
+
argv: stack_argv_proc
|
160
|
+
},
|
161
|
+
update: {
|
162
|
+
class: UpdateRunner,
|
163
|
+
parser: OptionParser.new { |opts|
|
164
|
+
opts.banner = "Usage: #{NAME} update [lock || template]"
|
165
|
+
|
166
|
+
opts.on("-c CLOUD", "--cloud CLOUD", "Select cloud") do |opt|
|
167
|
+
options.cloud = opt
|
168
|
+
end
|
169
|
+
|
170
|
+
opts.on("--config CONFIG", "Specify a different yaml config (default is wombat.yml)") do |opt|
|
171
|
+
options.wombat_yml = opt
|
172
|
+
end
|
173
|
+
},
|
174
|
+
argv: file_argv_proc
|
175
|
+
}
|
141
176
|
}
|
142
|
-
}
|
143
177
|
|
144
|
-
|
178
|
+
global.order!
|
145
179
|
|
146
|
-
|
147
|
-
|
148
|
-
|
180
|
+
command = args.empty? ? :help : ARGV.shift.to_sym
|
181
|
+
subcommand.fetch(command).fetch(:parser).order!
|
182
|
+
subcommand.fetch(command).fetch(:argv).call(options)
|
149
183
|
|
150
|
-
|
151
|
-
|
184
|
+
options.command = command
|
185
|
+
options.klass = subcommand.fetch(command).fetch(:class)
|
152
186
|
|
153
|
-
|
187
|
+
options
|
188
|
+
end
|
154
189
|
end
|
155
|
-
end
|
156
190
|
|
157
|
-
class ListRunner
|
191
|
+
class ListRunner
|
158
192
|
|
159
|
-
|
193
|
+
include Wombat::Common
|
160
194
|
|
161
|
-
|
195
|
+
attr_reader :templates
|
162
196
|
|
163
|
-
|
164
|
-
|
165
|
-
|
197
|
+
def initialize(opts)
|
198
|
+
@templates = opts.templates.nil? ? calculate_templates : opts.templates
|
199
|
+
end
|
166
200
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
201
|
+
def start
|
202
|
+
templates.each do |t|
|
203
|
+
if !File.exists?("#{conf['packer_dir']}/#{t}.json")
|
204
|
+
$stderr.puts "File #{conf['packer_dir']}/#{t}.json does not exist for template '#{t}'"
|
205
|
+
exit(1)
|
206
|
+
else
|
207
|
+
puts t
|
208
|
+
end
|
174
209
|
end
|
175
210
|
end
|
176
211
|
end
|
177
|
-
end
|
178
212
|
|
179
|
-
class Runner
|
213
|
+
class Runner
|
180
214
|
|
181
|
-
|
215
|
+
attr_reader :options
|
182
216
|
|
183
|
-
|
184
|
-
|
185
|
-
|
217
|
+
def initialize(options)
|
218
|
+
@options = options
|
219
|
+
end
|
186
220
|
|
187
|
-
|
188
|
-
|
221
|
+
def start
|
222
|
+
options.klass.new(options).start
|
223
|
+
end
|
189
224
|
end
|
190
225
|
end
|