cloud-mu 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +10 -2
- data/bin/mu-adopt +5 -1
- data/bin/mu-load-config.rb +2 -3
- data/bin/mu-run-tests +112 -27
- data/cloud-mu.gemspec +20 -20
- data/cookbooks/mu-tools/libraries/helper.rb +2 -1
- data/cookbooks/mu-tools/libraries/monkey.rb +35 -0
- data/cookbooks/mu-tools/recipes/google_api.rb +2 -2
- data/cookbooks/mu-tools/resources/disk.rb +1 -1
- data/extras/image-generators/Google/centos6.yaml +1 -0
- data/extras/image-generators/Google/centos7.yaml +1 -1
- data/modules/mommacat.ru +5 -15
- data/modules/mu.rb +10 -14
- data/modules/mu/adoption.rb +20 -14
- data/modules/mu/cleanup.rb +13 -9
- data/modules/mu/cloud.rb +26 -26
- data/modules/mu/clouds/aws.rb +100 -59
- data/modules/mu/clouds/aws/alarm.rb +4 -2
- data/modules/mu/clouds/aws/bucket.rb +25 -21
- data/modules/mu/clouds/aws/cache_cluster.rb +25 -23
- data/modules/mu/clouds/aws/collection.rb +21 -20
- data/modules/mu/clouds/aws/container_cluster.rb +47 -26
- data/modules/mu/clouds/aws/database.rb +57 -68
- data/modules/mu/clouds/aws/dnszone.rb +14 -14
- data/modules/mu/clouds/aws/endpoint.rb +20 -16
- data/modules/mu/clouds/aws/firewall_rule.rb +19 -16
- data/modules/mu/clouds/aws/folder.rb +7 -7
- data/modules/mu/clouds/aws/function.rb +15 -12
- data/modules/mu/clouds/aws/group.rb +14 -10
- data/modules/mu/clouds/aws/habitat.rb +16 -13
- data/modules/mu/clouds/aws/loadbalancer.rb +16 -15
- data/modules/mu/clouds/aws/log.rb +13 -10
- data/modules/mu/clouds/aws/msg_queue.rb +15 -8
- data/modules/mu/clouds/aws/nosqldb.rb +18 -11
- data/modules/mu/clouds/aws/notifier.rb +11 -6
- data/modules/mu/clouds/aws/role.rb +87 -70
- data/modules/mu/clouds/aws/search_domain.rb +30 -19
- data/modules/mu/clouds/aws/server.rb +102 -72
- data/modules/mu/clouds/aws/server_pool.rb +47 -28
- data/modules/mu/clouds/aws/storage_pool.rb +5 -6
- data/modules/mu/clouds/aws/user.rb +13 -10
- data/modules/mu/clouds/aws/vpc.rb +135 -121
- data/modules/mu/clouds/azure.rb +16 -9
- data/modules/mu/clouds/azure/container_cluster.rb +2 -3
- data/modules/mu/clouds/azure/firewall_rule.rb +10 -10
- data/modules/mu/clouds/azure/habitat.rb +8 -6
- data/modules/mu/clouds/azure/loadbalancer.rb +5 -5
- data/modules/mu/clouds/azure/role.rb +8 -10
- data/modules/mu/clouds/azure/server.rb +65 -25
- data/modules/mu/clouds/azure/user.rb +5 -7
- data/modules/mu/clouds/azure/vpc.rb +12 -15
- data/modules/mu/clouds/cloudformation.rb +8 -7
- data/modules/mu/clouds/cloudformation/vpc.rb +2 -4
- data/modules/mu/clouds/google.rb +39 -24
- data/modules/mu/clouds/google/bucket.rb +9 -11
- data/modules/mu/clouds/google/container_cluster.rb +27 -42
- data/modules/mu/clouds/google/database.rb +6 -9
- data/modules/mu/clouds/google/firewall_rule.rb +11 -10
- data/modules/mu/clouds/google/folder.rb +16 -9
- data/modules/mu/clouds/google/function.rb +127 -161
- data/modules/mu/clouds/google/group.rb +21 -18
- data/modules/mu/clouds/google/habitat.rb +18 -15
- data/modules/mu/clouds/google/loadbalancer.rb +14 -16
- data/modules/mu/clouds/google/role.rb +48 -31
- data/modules/mu/clouds/google/server.rb +105 -105
- data/modules/mu/clouds/google/server_pool.rb +12 -31
- data/modules/mu/clouds/google/user.rb +67 -13
- data/modules/mu/clouds/google/vpc.rb +58 -65
- data/modules/mu/config.rb +89 -1738
- data/modules/mu/config/bucket.rb +3 -3
- data/modules/mu/config/collection.rb +3 -3
- data/modules/mu/config/container_cluster.rb +2 -2
- data/modules/mu/config/dnszone.rb +5 -5
- data/modules/mu/config/doc_helpers.rb +517 -0
- data/modules/mu/config/endpoint.rb +3 -3
- data/modules/mu/config/firewall_rule.rb +118 -3
- data/modules/mu/config/folder.rb +3 -3
- data/modules/mu/config/function.rb +2 -2
- data/modules/mu/config/group.rb +3 -3
- data/modules/mu/config/habitat.rb +3 -3
- data/modules/mu/config/loadbalancer.rb +3 -3
- data/modules/mu/config/log.rb +3 -3
- data/modules/mu/config/msg_queue.rb +3 -3
- data/modules/mu/config/nosqldb.rb +3 -3
- data/modules/mu/config/notifier.rb +2 -2
- data/modules/mu/config/ref.rb +333 -0
- data/modules/mu/config/role.rb +3 -3
- data/modules/mu/config/schema_helpers.rb +508 -0
- data/modules/mu/config/search_domain.rb +3 -3
- data/modules/mu/config/server.rb +86 -58
- data/modules/mu/config/server_pool.rb +2 -2
- data/modules/mu/config/tail.rb +189 -0
- data/modules/mu/config/user.rb +3 -3
- data/modules/mu/config/vpc.rb +44 -4
- data/modules/mu/defaults/Google.yaml +2 -2
- data/modules/mu/deploy.rb +13 -10
- data/modules/mu/groomer.rb +1 -1
- data/modules/mu/groomers/ansible.rb +69 -24
- data/modules/mu/groomers/chef.rb +52 -44
- data/modules/mu/logger.rb +17 -14
- data/modules/mu/master.rb +317 -2
- data/modules/mu/master/chef.rb +3 -4
- data/modules/mu/master/ldap.rb +3 -3
- data/modules/mu/master/ssl.rb +12 -2
- data/modules/mu/mommacat.rb +85 -1766
- data/modules/mu/mommacat/daemon.rb +394 -0
- data/modules/mu/mommacat/naming.rb +366 -0
- data/modules/mu/mommacat/storage.rb +689 -0
- data/modules/tests/bucket.yml +4 -0
- data/modules/tests/{win2k12.yaml → needwork/win2k12.yaml} +0 -0
- data/modules/tests/regrooms/aws-iam.yaml +201 -0
- data/modules/tests/regrooms/bucket.yml +19 -0
- metadata +112 -102
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63e9eb2d1b4db9fe4dc96bfdc81fc6ae47c6e0b6afa1113226ebf4d798a4990a
|
4
|
+
data.tar.gz: 60ea7c4c936d2f66e300705b1cbaaca178476581ad106d05f7f48dac310f2003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7862eacf10e60e1ee974b7a518177baf4d16271724d4ad9b0fd02a27dd3a7a9b5de5caa04aa6ce5bfe171449ffcbebdafd0012c2299c4ac2e39442fbbd0fcfd
|
7
|
+
data.tar.gz: a72c384253bc6b1649060ca33ceaafb28a1f9fb9d5cd699af2bcc63f7b1bbad3efb9ca1b67fbcc08b4fed0efa2d7f533ef3556abb15ed977490912f09e6350de
|
data/Dockerfile
CHANGED
@@ -4,17 +4,25 @@ RUN mkdir -p /opt/mu/etc/ /home/mu /usr/local/ruby-current/lib/ruby/gems/2.5.0/g
|
|
4
4
|
|
5
5
|
WORKDIR /home/mu
|
6
6
|
|
7
|
+
RUN df -h
|
8
|
+
|
7
9
|
RUN apt-get update
|
8
10
|
|
9
11
|
RUN apt-get install -y ruby2.5-dev dnsutils ansible build-essential
|
10
12
|
|
11
13
|
RUN apt-get upgrade -y
|
12
14
|
|
15
|
+
RUN df -h
|
16
|
+
|
13
17
|
COPY ./cloud-mu-*.gem /home/mu
|
14
18
|
|
15
|
-
RUN gem install ./cloud-mu-*.gem
|
19
|
+
RUN gem install ./cloud-mu-*.gem -N
|
20
|
+
|
21
|
+
RUN df -h
|
22
|
+
|
23
|
+
RUN ls -la
|
16
24
|
|
17
|
-
RUN rm cloud-mu-*.gem
|
25
|
+
#RUN rm --verbose -f cloud-mu-*.gem
|
18
26
|
|
19
27
|
RUN apt-get remove -y build-essential ruby2.5-dev
|
20
28
|
|
data/bin/mu-adopt
CHANGED
@@ -103,7 +103,11 @@ end
|
|
103
103
|
|
104
104
|
|
105
105
|
adoption = MU::Adoption.new(clouds: clouds, types: types, parent: $opt[:parent], billing: $opt[:billing], sources: $opt[:sources], credentials: $opt[:credentials], group_by: $opt[:grouping].to_sym, savedeploys: $opt[:savedeploys], diff: $opt[:diff], habitats: $opt[:habitats])
|
106
|
-
adoption.scrapeClouds
|
106
|
+
found = adoption.scrapeClouds
|
107
|
+
if found.nil? or found.empty?
|
108
|
+
MU.log "No resources found to adopt", MU::WARN, details: {"clouds" => clouds, "types" => types }
|
109
|
+
exit
|
110
|
+
end
|
107
111
|
MU.log "Generating baskets", MU::DEBUG
|
108
112
|
boks = adoption.generateBaskets(prefix: $opt[:appname])
|
109
113
|
|
data/bin/mu-load-config.rb
CHANGED
@@ -36,8 +36,7 @@ def validateClouds(cfg)
|
|
36
36
|
cfg[cloud]["default"]["default"] = true
|
37
37
|
found_default = true
|
38
38
|
else
|
39
|
-
|
40
|
-
cfg[cloud].each_pair { |acctalias, acct|
|
39
|
+
cfg[cloud].values.each { |acct|
|
41
40
|
if acct["default"]
|
42
41
|
if found_default
|
43
42
|
puts "Multiple accounts have 'default' set in #{cloud}"
|
@@ -205,7 +204,7 @@ def cfgPath
|
|
205
204
|
end
|
206
205
|
end
|
207
206
|
home = Etc.getpwuid(Process.uid).dir
|
208
|
-
|
207
|
+
Etc.getpwuid(Process.uid).name # validates existence of a username
|
209
208
|
if Process.uid == 0 and !in_gem
|
210
209
|
if ENV.include?('MU_INSTALLDIR')
|
211
210
|
ENV['MU_INSTALLDIR']+"/etc/mu.yaml"
|
data/bin/mu-run-tests
CHANGED
@@ -13,29 +13,46 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
+
bindir = File.realpath(File.expand_path(File.dirname(__FILE__)))
|
17
|
+
dir = File.realpath(File.expand_path(bindir+"/../modules/tests"))
|
18
|
+
Dir.chdir(dir)
|
19
|
+
|
16
20
|
require 'colorize'
|
17
21
|
require 'optimist'
|
18
|
-
bindir = File.realpath(File.expand_path(File.dirname(__FILE__)))
|
19
22
|
require bindir+"/mu-load-config.rb"
|
20
23
|
require 'mu'
|
21
24
|
|
25
|
+
require 'rubygems'
|
26
|
+
require 'bundler/setup'
|
27
|
+
require 'json'
|
28
|
+
require 'erb'
|
29
|
+
require 'json-schema'
|
30
|
+
|
22
31
|
$opts = Optimist::options do
|
23
32
|
banner <<-EOS
|
24
33
|
Usage:
|
25
|
-
#{$0} [-
|
34
|
+
#{$0} [-m <#>] [-f] [-v] [specific test BoK to run [...]]
|
26
35
|
EOS
|
27
36
|
opt :max_threads, "Environment to set on creation.", :require => false, :default => 3, :type => :integer
|
28
37
|
opt :full, "Actually run deploys, instead of --dryrun", :require => false, :default => false
|
38
|
+
opt :verbose, "Show more information while running", :require => false, :default => false
|
29
39
|
end
|
30
40
|
|
31
|
-
|
32
|
-
Dir.chdir(dir)
|
41
|
+
only = ARGV
|
33
42
|
|
34
43
|
files = Dir.glob("*.yaml", base: dir)
|
35
44
|
files.concat(Dir.glob("*.yml", base: dir))
|
36
45
|
baseclouds = MU::Cloud.supportedClouds.reject { |c| c == "CloudFormation" }
|
37
46
|
|
38
47
|
commands = {}
|
48
|
+
failures = []
|
49
|
+
if only and only.size > 0
|
50
|
+
files.reject! { |f| !only.include?(f) }
|
51
|
+
if files.size == 0
|
52
|
+
MU.log "No files in #{dir} matched requested list", MU::WARN, details: only
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
end
|
39
56
|
|
40
57
|
files.each { |f|
|
41
58
|
clouds = baseclouds.dup
|
@@ -54,12 +71,68 @@ files.each { |f|
|
|
54
71
|
break
|
55
72
|
}
|
56
73
|
clouds.each { |cloud|
|
57
|
-
|
74
|
+
cmd = "mu-deploy #{f} --cloud #{cloud} #{$opts[:full] ? "" : "--dryrun"}"
|
75
|
+
commands[cmd] = {
|
76
|
+
"file" => f,
|
77
|
+
"cloud" => cloud,
|
78
|
+
}
|
79
|
+
if $opts[:full]
|
80
|
+
$environment = "dev"
|
81
|
+
begin
|
82
|
+
conf_engine = MU::Config.new(f, cloud: cloud)
|
83
|
+
rescue StandardError => e
|
84
|
+
MU.log e.message+" parsing "+f+" with cloud "+cloud, MU::WARN, details: e.backtrace
|
85
|
+
failures << f+" ("+commands[cmd]["cloud"]+")"
|
86
|
+
next
|
87
|
+
end
|
88
|
+
parsed = MU::Config.stripConfig(conf_engine.config)
|
89
|
+
types = []
|
90
|
+
MU::Cloud.resource_types.values.each { |attrs|
|
91
|
+
if parsed.has_key?(attrs[:cfg_plural])
|
92
|
+
types << attrs[:cfg_plural]
|
93
|
+
end
|
94
|
+
}
|
95
|
+
commands[cmd]["parsed"] = parsed
|
96
|
+
commands[cmd]["types"] = types
|
97
|
+
end
|
58
98
|
}
|
59
99
|
}
|
60
100
|
|
61
101
|
puts "Running #{commands.size.to_s.bold} #{$opts[:full] ? "full deploy" : "parse"} tests from #{files.size.to_s.bold} Baskets of Kittens across #{baseclouds.size.to_s.bold} clouds"
|
62
102
|
|
103
|
+
@output_semaphore = Mutex.new
|
104
|
+
|
105
|
+
def execCommand(cmd, results_stash)
|
106
|
+
@output_semaphore.synchronize {
|
107
|
+
puts cmd if $opts[:verbose]
|
108
|
+
}
|
109
|
+
|
110
|
+
ok = true
|
111
|
+
output = %x{#{cmd} 2>&1}
|
112
|
+
ok = false if $?.exitstatus != 0
|
113
|
+
|
114
|
+
results_stash["output"] += output
|
115
|
+
|
116
|
+
@output_semaphore.synchronize {
|
117
|
+
if ok
|
118
|
+
if $opts[:verbose]
|
119
|
+
puts "#{cmd} SUCCEEDED".green
|
120
|
+
else
|
121
|
+
print ".".green
|
122
|
+
end
|
123
|
+
else
|
124
|
+
if $opts[:verbose]
|
125
|
+
puts "#{cmd} FAILED:".light_red
|
126
|
+
puts output
|
127
|
+
else
|
128
|
+
print ".".light_red
|
129
|
+
end
|
130
|
+
end
|
131
|
+
}
|
132
|
+
|
133
|
+
ok
|
134
|
+
end
|
135
|
+
|
63
136
|
threads = []
|
64
137
|
results = {}
|
65
138
|
commands.keys.each { |cmd|
|
@@ -72,21 +145,40 @@ commands.keys.each { |cmd|
|
|
72
145
|
end
|
73
146
|
|
74
147
|
threads << Thread.new(cmd) { |cmd_thr|
|
75
|
-
results[cmd_thr] = {}
|
76
|
-
|
77
|
-
|
78
|
-
if $?.exitstatus != 0
|
79
|
-
results[cmd_thr]["status"] = false
|
80
|
-
print ".".light_red
|
81
|
-
else
|
82
|
-
results[cmd_thr]["status"] = true
|
83
|
-
print ".".green
|
148
|
+
results[cmd_thr] = { "output" => "", "failed" => [] }
|
149
|
+
if !execCommand(cmd_thr, results[cmd_thr])
|
150
|
+
results[cmd_thr]["failed"] << "main"
|
84
151
|
end
|
152
|
+
|
85
153
|
if $opts[:full] and results[cmd_thr]["output"].match(/deploy - Deployment id: .*? \((.*?)\)/)
|
86
154
|
deploy_id = Regexp.last_match[1]
|
87
|
-
|
88
|
-
if
|
89
|
-
|
155
|
+
adoptdir = Dir.mktmpdir(commands[cmd_thr]["file"].gsub(/[^a-z0-9]|yaml$/i, ""))
|
156
|
+
if commands[cmd_thr]["types"] and commands[cmd_thr]["types"].size > 0
|
157
|
+
adopt = "cd #{adoptdir} && mu-adopt --appname adoptone --grouping omnibus --clouds #{commands[cmd_thr]["cloud"]} --types #{commands[cmd_thr]["types"].join(" ")} 2>&1"
|
158
|
+
if !execCommand(adopt, results[cmd_thr])
|
159
|
+
results[cmd_thr]["failed"] << "adopt"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
if File.exist?(dir+"/regrooms/"+commands[cmd_thr]["file"])
|
164
|
+
regroom = "mu-deploy regrooms/#{commands[cmd_thr]["file"]} --cloud #{commands[cmd_thr]["cloud"]} --update #{deploy_id} 2>&1"
|
165
|
+
if !execCommand(regroom, results[cmd_thr])
|
166
|
+
results[cmd_thr]["failed"] << "regroom"
|
167
|
+
end
|
168
|
+
if commands[cmd_thr]["types"] and commands[cmd_thr]["types"].size > 0
|
169
|
+
re_adopt = "cd #{adoptdir} && mu-adopt --appname adopttwo --grouping omnibus --clouds #{commands[cmd_thr]["cloud"]} --types #{commands[cmd_thr]["types"].join(" ")} 2>&1"
|
170
|
+
if !execCommand(re_adopt, results[cmd_thr])
|
171
|
+
results[cmd_thr]["failed"] << "second adopt"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
# TODO big flex is to read back both adopted BoKs and .diff them, but without
|
175
|
+
# all resources having implemented adoption this isn't much of a test yet
|
176
|
+
end
|
177
|
+
|
178
|
+
FileUtils.remove_entry(adoptdir)
|
179
|
+
cleanup = %Q{mu-cleanup #{deploy_id} --skipsnapshots}
|
180
|
+
if !execCommand(cleanup, results[cmd_thr])
|
181
|
+
results[cmd_thr]["failed"] << "cleanup"
|
90
182
|
end
|
91
183
|
end
|
92
184
|
}
|
@@ -96,21 +188,14 @@ threads.each { |t|
|
|
96
188
|
}
|
97
189
|
puts ""
|
98
190
|
|
99
|
-
failures = []
|
100
191
|
results.keys.sort { |a, b|
|
101
|
-
|
102
|
-
1
|
103
|
-
elsif !results[b]["status"] and results[a]["status"]
|
104
|
-
-1
|
105
|
-
else
|
106
|
-
0
|
107
|
-
end
|
192
|
+
results[b]["failed"].size <=> results[a]["failed"].size
|
108
193
|
}.each { |cmd|
|
109
|
-
if
|
194
|
+
if results[cmd]["failed"].size > 0
|
110
195
|
puts cmd+" failed:".light_red
|
111
196
|
puts results[cmd]["output"].yellow
|
112
197
|
puts "^ #{cmd}".light_red
|
113
|
-
failures << commands[cmd]["file"]+"
|
198
|
+
failures << commands[cmd]["file"]+" in "+commands[cmd]["cloud"]+" ("+results[cmd]["failed"].join(", ")+")"
|
114
199
|
else
|
115
200
|
puts cmd+" passed".green
|
116
201
|
end
|
data/cloud-mu.gemspec
CHANGED
@@ -17,8 +17,8 @@ end
|
|
17
17
|
|
18
18
|
Gem::Specification.new do |s|
|
19
19
|
s.name = 'cloud-mu'
|
20
|
-
s.version = '3.1.
|
21
|
-
s.date = '2020-
|
20
|
+
s.version = '3.1.4'
|
21
|
+
s.date = '2020-02-14'
|
22
22
|
s.require_paths = ['modules']
|
23
23
|
s.required_ruby_version = '>= 2.4'
|
24
24
|
s.summary = "The eGTLabs Mu toolkit for unified cloud deployments"
|
@@ -35,31 +35,31 @@ EOF
|
|
35
35
|
s.homepage =
|
36
36
|
'https://github.com/cloudamatic/mu'
|
37
37
|
s.license = 'BSD-3-Clause-Attribution'
|
38
|
-
s.add_runtime_dependency '
|
39
|
-
s.add_runtime_dependency 'inifile', "~> 3.0"
|
40
|
-
s.add_runtime_dependency 'bundler', "~> 1.17"
|
41
|
-
s.add_runtime_dependency 'yard', "~> 0.9"
|
42
|
-
s.add_runtime_dependency 'ruby-graphviz', "~> 1.2"
|
38
|
+
s.add_runtime_dependency 'addressable', '~> 2.5'
|
43
39
|
s.add_runtime_dependency "aws-sdk-core", "< 3"
|
40
|
+
s.add_runtime_dependency 'azure_sdk', "~> 0.52"
|
41
|
+
s.add_runtime_dependency 'bundler', "~> 1.17"
|
44
42
|
s.add_runtime_dependency 'chronic_duration', "~> 0.10"
|
45
|
-
s.add_runtime_dependency 'simple-password-gen', "~> 0.1"
|
46
|
-
s.add_runtime_dependency 'optimist', "~> 3.0"
|
47
|
-
s.add_runtime_dependency 'json-schema', "~> 2.8"
|
48
|
-
s.add_runtime_dependency 'colorize', "~> 0.8"
|
49
43
|
s.add_runtime_dependency 'color', "~> 1.8"
|
50
|
-
s.add_runtime_dependency '
|
51
|
-
s.add_runtime_dependency '
|
52
|
-
s.add_runtime_dependency '
|
44
|
+
s.add_runtime_dependency 'colorize', "~> 0.8"
|
45
|
+
s.add_runtime_dependency 'erubis', "~> 2.7"
|
46
|
+
s.add_runtime_dependency 'google-api-client', "~> 0.36.4"
|
47
|
+
s.add_runtime_dependency 'googleauth', "~> 0.6"
|
48
|
+
s.add_runtime_dependency 'inifile', "~> 3.0"
|
49
|
+
s.add_runtime_dependency 'json-schema', "~> 2.8"
|
53
50
|
s.add_runtime_dependency 'net-ldap', "~> 0.16"
|
54
51
|
s.add_runtime_dependency 'net-ssh', "~> 4.2"
|
55
52
|
s.add_runtime_dependency 'net-ssh-multi', '~> 1.2', '>= 1.2.1'
|
56
|
-
s.add_runtime_dependency '
|
57
|
-
s.add_runtime_dependency '
|
53
|
+
s.add_runtime_dependency 'netaddr', '~> 2.0'
|
54
|
+
s.add_runtime_dependency 'nokogiri', "~> 1.10"
|
55
|
+
s.add_runtime_dependency 'optimist', "~> 3.0"
|
56
|
+
s.add_runtime_dependency 'rack', "~> 2.0"
|
57
|
+
s.add_runtime_dependency 'ruby-graphviz', "~> 1.2"
|
58
58
|
s.add_runtime_dependency 'rubocop', '~> 0.58'
|
59
|
-
s.add_runtime_dependency '
|
59
|
+
s.add_runtime_dependency 'rubyzip', "~> 2.0"
|
60
|
+
s.add_runtime_dependency 'simple-password-gen', "~> 0.1"
|
60
61
|
s.add_runtime_dependency 'slack-notifier', "~> 2.3"
|
61
|
-
s.add_runtime_dependency '
|
62
|
-
s.add_runtime_dependency 'rack', "~> 2.0"
|
62
|
+
s.add_runtime_dependency 'solve', '~> 4.0'
|
63
63
|
s.add_runtime_dependency 'thin', "~> 1.7"
|
64
|
-
s.add_runtime_dependency '
|
64
|
+
s.add_runtime_dependency 'yard', "~> 0.9"
|
65
65
|
end
|
@@ -49,7 +49,6 @@ module Mutools
|
|
49
49
|
@authorizer = nil
|
50
50
|
def set_gcp_cfg_params
|
51
51
|
begin
|
52
|
-
require "google/cloud"
|
53
52
|
require "googleauth"
|
54
53
|
@project ||= get_google_metadata("project/project-id")
|
55
54
|
@authorizer ||= ::Google::Auth.get_application_default(['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/compute.readonly'])
|
@@ -202,6 +201,8 @@ module Mutools
|
|
202
201
|
Chef::Log.info("Fetching deploy secret: #{gsutil} cp gs://#{bucket}/#{filename} -")
|
203
202
|
cmd = if File.exist?("/usr/bin/python2.7")
|
204
203
|
%Q{CLOUDSDK_PYTHON=/usr/bin/python2.7 #{gsutil} cp gs://#{bucket}/#{filename} -}
|
204
|
+
elsif File.exist?("/opt/rh/python27/root/usr/bin/python")
|
205
|
+
%Q{CLOUDSDK_PYTHON=/opt/rh/python27/root/usr/bin/python #{gsutil} cp gs://#{bucket}/#{filename} -}
|
205
206
|
else
|
206
207
|
%Q{#{gsutil} cp gs://#{bucket}/#{filename} -}
|
207
208
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Chef
|
2
|
+
class Provider
|
3
|
+
class Package
|
4
|
+
class Rubygems < Chef::Provider::Package
|
5
|
+
|
6
|
+
def install_via_gem_command(name, version)
|
7
|
+
src = []
|
8
|
+
if new_resource.source.is_a?(String) && new_resource.source =~ /\.gem$/i
|
9
|
+
name = new_resource.source
|
10
|
+
else
|
11
|
+
src << "--clear-sources" if new_resource.clear_sources
|
12
|
+
src += gem_sources.map { |s| "--source=#{s}" }
|
13
|
+
end
|
14
|
+
src_str = src.empty? ? "" : " #{src.join(" ")}"
|
15
|
+
cmd = if !version.nil? && !version.empty?
|
16
|
+
"#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src_str}#{opts}"
|
17
|
+
else
|
18
|
+
"#{gem_binary_path} install \"#{name}\" -q --no-rdoc --no-ri #{src_str}#{opts}"
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
shell_out_with_timeout!(cmd, env: nil)
|
23
|
+
rescue StandardError => e
|
24
|
+
if cmd.match(/--no-rdoc|--no-ri/)
|
25
|
+
cmd.gsub!(/--no-rdoc --no-ri/, "--no-document")
|
26
|
+
retry
|
27
|
+
end
|
28
|
+
raise e
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -16,10 +16,10 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
["google-api-client", "
|
19
|
+
["google-api-client", "googleauth"].each { |gem|
|
20
20
|
chef_gem gem do
|
21
21
|
compile_time true
|
22
22
|
action :install
|
23
|
-
only_if { !get_google_metadata("name").nil? }
|
23
|
+
only_if { !get_google_metadata("instance/name").nil? }
|
24
24
|
end
|
25
25
|
}
|
data/modules/mommacat.ru
CHANGED
@@ -16,7 +16,7 @@ require 'pp'
|
|
16
16
|
require 'base64'
|
17
17
|
require 'etc'
|
18
18
|
|
19
|
-
|
19
|
+
Etc.getpwuid(Process.uid).dir
|
20
20
|
|
21
21
|
if !ENV.include?('MU_INSTALLDIR')
|
22
22
|
ENV['MU_INSTALLDIR'] = "/opt/mu"
|
@@ -52,7 +52,7 @@ end
|
|
52
52
|
|
53
53
|
begin
|
54
54
|
MU::MommaCat.syncMonitoringConfig(false)
|
55
|
-
rescue
|
55
|
+
rescue StandardError => e
|
56
56
|
MU.log e.inspect, MU::ERR, details: e.backtrace
|
57
57
|
# ...but don't die!
|
58
58
|
end
|
@@ -64,14 +64,12 @@ Thread.new {
|
|
64
64
|
MU::MommaCat.cleanTerminatedInstances
|
65
65
|
MU::Master.cleanExpiredScratchpads if $ENABLE_SCRATCHPAD
|
66
66
|
sleep 60
|
67
|
-
rescue
|
67
|
+
rescue StandardError => e
|
68
68
|
MU.log "Error in cleanTerminatedInstances thread: #{e.inspect}", MU::ERR, details: e.backtrace
|
69
69
|
retry
|
70
70
|
end while true
|
71
71
|
}
|
72
72
|
|
73
|
-
required_vars = ["mu_id", "mu_deploy_secret", "mu_resource_name", "mu_resource_type", "mu_instance_id"]
|
74
|
-
|
75
73
|
# Use a template to generate a pleasant-looking HTML page for simple messages
|
76
74
|
# and errors.
|
77
75
|
def genHTMLMessage(title: "", headline: "", msg: "", template: $MU_CFG['html_template'], extra_vars: {})
|
@@ -193,7 +191,6 @@ def releaseKitten(mu_id)
|
|
193
191
|
end
|
194
192
|
|
195
193
|
app = proc do |env|
|
196
|
-
ok = false
|
197
194
|
returnval = [
|
198
195
|
200,
|
199
196
|
{
|
@@ -318,7 +315,7 @@ app = proc do |env|
|
|
318
315
|
elsif !filter or !path
|
319
316
|
returnval = throw404 env['REQUEST_PATH']
|
320
317
|
else
|
321
|
-
MU::
|
318
|
+
MU::Master.addInstanceToEtcHosts(path, filter)
|
322
319
|
returnval = [
|
323
320
|
200,
|
324
321
|
{
|
@@ -356,7 +353,6 @@ app = proc do |env|
|
|
356
353
|
|
357
354
|
elsif !env["rack.input"].nil?
|
358
355
|
req = Rack::Utils.parse_nested_query(env["rack.input"].read)
|
359
|
-
ok = true
|
360
356
|
|
361
357
|
if req["mu_user"].nil?
|
362
358
|
req["mu_user"] = "mu"
|
@@ -373,7 +369,6 @@ app = proc do |env|
|
|
373
369
|
kittenpile = getKittenPile(req)
|
374
370
|
if kittenpile.nil? or kittenpile.original_config.nil? or kittenpile.original_config[req["mu_resource_type"]+"s"].nil?
|
375
371
|
returnval = throw500 "Couldn't find config data for #{req["mu_resource_type"]} in deploy_id #{req["mu_id"]}"
|
376
|
-
ok = false
|
377
372
|
next
|
378
373
|
end
|
379
374
|
server_cfg = nil
|
@@ -385,7 +380,6 @@ app = proc do |env|
|
|
385
380
|
}
|
386
381
|
if server_cfg.nil?
|
387
382
|
returnval = throw500 "Couldn't find config data for #{req["mu_resource_type"]} name: #{req["mu_resource_name"]} deploy_id: #{req["mu_id"]}"
|
388
|
-
ok = false
|
389
383
|
next
|
390
384
|
end
|
391
385
|
|
@@ -426,7 +420,6 @@ MU.log "ADDVOLUME REQUEST", MU::WARN, details: params
|
|
426
420
|
instance.addVolume(params["dev"], params["size"], delete_on_termination: params["delete_on_termination"])
|
427
421
|
else
|
428
422
|
returnval = throw500 "I don't know how to add a volume for #{instance}"
|
429
|
-
ok = false
|
430
423
|
end
|
431
424
|
elsif !instance.nil?
|
432
425
|
if !req["mu_bootstrap"].nil?
|
@@ -434,16 +427,13 @@ MU.log "ADDVOLUME REQUEST", MU::WARN, details: params
|
|
434
427
|
returnval[2] = ["Grooming asynchronously, check Momma Cat logs on the master for details."]
|
435
428
|
else
|
436
429
|
returnval = throw500 "Didn't get 'mu_bootstrap' parameter from instance id '#{req["mu_instance_id"]}'"
|
437
|
-
ok = false
|
438
430
|
end
|
439
431
|
else
|
440
432
|
returnval = throw500 "No such instance id '#{req["mu_instance_id"]}' nor was this an SSL signing request"
|
441
|
-
ok = false
|
442
433
|
end
|
443
434
|
end
|
444
|
-
rescue
|
435
|
+
rescue StandardError => e
|
445
436
|
returnval = throw500 "Invalid request: #{e.inspect} (#{req})", e.backtrace
|
446
|
-
ok = false
|
447
437
|
ensure
|
448
438
|
if !req.nil?
|
449
439
|
releaseKitten(req['mu_id'])
|