cloud-mu 3.1.6 → 3.2.0
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/bin/mu-adopt +4 -12
- data/bin/mu-azure-tests +57 -0
- data/bin/mu-cleanup +2 -4
- data/bin/mu-configure +37 -1
- data/bin/mu-deploy +3 -3
- data/bin/mu-findstray-tests +25 -0
- data/bin/mu-gen-docs +2 -4
- data/bin/mu-run-tests +23 -10
- data/cloud-mu.gemspec +2 -2
- data/cookbooks/mu-tools/libraries/helper.rb +1 -1
- data/cookbooks/mu-tools/recipes/apply_security.rb +14 -14
- data/cookbooks/mu-tools/recipes/aws_api.rb +9 -0
- data/extras/generate-stock-images +1 -0
- data/modules/mu.rb +82 -95
- data/modules/mu/adoption.rb +356 -56
- data/modules/mu/cleanup.rb +21 -20
- data/modules/mu/cloud.rb +79 -1753
- data/modules/mu/cloud/database.rb +49 -0
- data/modules/mu/cloud/dnszone.rb +46 -0
- data/modules/mu/cloud/machine_images.rb +212 -0
- data/modules/mu/cloud/providers.rb +81 -0
- data/modules/mu/cloud/resource_base.rb +920 -0
- data/modules/mu/cloud/server.rb +40 -0
- data/modules/mu/cloud/server_pool.rb +1 -0
- data/modules/mu/cloud/ssh_sessions.rb +228 -0
- data/modules/mu/cloud/winrm_sessions.rb +237 -0
- data/modules/mu/cloud/wrappers.rb +165 -0
- data/modules/mu/config.rb +122 -80
- data/modules/mu/config/alarm.rb +2 -6
- data/modules/mu/config/bucket.rb +1 -1
- data/modules/mu/config/cache_cluster.rb +1 -1
- data/modules/mu/config/collection.rb +1 -1
- data/modules/mu/config/container_cluster.rb +2 -2
- data/modules/mu/config/database.rb +83 -104
- data/modules/mu/config/database.yml +1 -2
- data/modules/mu/config/dnszone.rb +1 -1
- data/modules/mu/config/doc_helpers.rb +4 -5
- data/modules/mu/config/endpoint.rb +1 -1
- data/modules/mu/config/firewall_rule.rb +3 -19
- data/modules/mu/config/folder.rb +1 -1
- data/modules/mu/config/function.rb +1 -1
- data/modules/mu/config/group.rb +1 -1
- data/modules/mu/config/habitat.rb +1 -1
- data/modules/mu/config/loadbalancer.rb +57 -11
- data/modules/mu/config/log.rb +1 -1
- data/modules/mu/config/msg_queue.rb +1 -1
- data/modules/mu/config/nosqldb.rb +1 -1
- data/modules/mu/config/notifier.rb +1 -1
- data/modules/mu/config/ref.rb +30 -4
- data/modules/mu/config/role.rb +1 -1
- data/modules/mu/config/schema_helpers.rb +30 -34
- data/modules/mu/config/search_domain.rb +1 -1
- data/modules/mu/config/server.rb +4 -12
- data/modules/mu/config/server_pool.rb +3 -7
- data/modules/mu/config/storage_pool.rb +1 -1
- data/modules/mu/config/tail.rb +10 -0
- data/modules/mu/config/user.rb +1 -1
- data/modules/mu/config/vpc.rb +12 -17
- data/modules/mu/defaults/AWS.yaml +32 -32
- data/modules/mu/defaults/Azure.yaml +1 -0
- data/modules/mu/defaults/Google.yaml +1 -0
- data/modules/mu/deploy.rb +16 -15
- data/modules/mu/groomer.rb +15 -0
- data/modules/mu/groomers/chef.rb +3 -0
- data/modules/mu/logger.rb +120 -144
- data/modules/mu/master.rb +1 -1
- data/modules/mu/mommacat.rb +54 -25
- data/modules/mu/mommacat/daemon.rb +10 -7
- data/modules/mu/mommacat/naming.rb +82 -3
- data/modules/mu/mommacat/search.rb +47 -15
- data/modules/mu/mommacat/storage.rb +72 -41
- data/modules/mu/{clouds → providers}/README.md +1 -1
- data/modules/mu/{clouds → providers}/aws.rb +114 -47
- data/modules/mu/{clouds → providers}/aws/alarm.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/bucket.rb +2 -2
- data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +10 -46
- data/modules/mu/{clouds → providers}/aws/collection.rb +3 -3
- data/modules/mu/{clouds → providers}/aws/container_cluster.rb +15 -33
- data/modules/mu/providers/aws/database.rb +1744 -0
- data/modules/mu/{clouds → providers}/aws/dnszone.rb +2 -5
- data/modules/mu/{clouds → providers}/aws/endpoint.rb +2 -11
- data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +33 -29
- data/modules/mu/{clouds → providers}/aws/folder.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/function.rb +2 -10
- data/modules/mu/{clouds → providers}/aws/group.rb +9 -13
- data/modules/mu/{clouds → providers}/aws/habitat.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +41 -33
- data/modules/mu/{clouds → providers}/aws/log.rb +2 -2
- data/modules/mu/{clouds → providers}/aws/msg_queue.rb +2 -8
- data/modules/mu/{clouds → providers}/aws/nosqldb.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/notifier.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/role.rb +7 -7
- data/modules/mu/{clouds → providers}/aws/search_domain.rb +8 -13
- data/modules/mu/{clouds → providers}/aws/server.rb +55 -90
- data/modules/mu/{clouds → providers}/aws/server_pool.rb +10 -33
- data/modules/mu/{clouds → providers}/aws/storage_pool.rb +19 -36
- data/modules/mu/{clouds → providers}/aws/user.rb +8 -12
- data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/vpc.rb +135 -70
- data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
- data/modules/mu/{clouds → providers}/azure.rb +4 -1
- data/modules/mu/{clouds → providers}/azure/container_cluster.rb +1 -5
- data/modules/mu/{clouds → providers}/azure/firewall_rule.rb +8 -1
- data/modules/mu/{clouds → providers}/azure/habitat.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/loadbalancer.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/role.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/server.rb +30 -23
- data/modules/mu/{clouds → providers}/azure/user.rb +1 -1
- data/modules/mu/{clouds → providers}/azure/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/vpc.rb +4 -6
- data/modules/mu/{clouds → providers}/cloudformation.rb +1 -1
- data/modules/mu/{clouds → providers}/cloudformation/alarm.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/cache_cluster.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/collection.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/database.rb +6 -17
- data/modules/mu/{clouds → providers}/cloudformation/dnszone.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/firewall_rule.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/loadbalancer.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/log.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/server.rb +7 -7
- data/modules/mu/{clouds → providers}/cloudformation/server_pool.rb +5 -5
- data/modules/mu/{clouds → providers}/cloudformation/vpc.rb +3 -3
- data/modules/mu/{clouds → providers}/docker.rb +0 -0
- data/modules/mu/{clouds → providers}/google.rb +14 -6
- data/modules/mu/{clouds → providers}/google/bucket.rb +1 -1
- data/modules/mu/{clouds → providers}/google/container_cluster.rb +28 -13
- data/modules/mu/{clouds → providers}/google/database.rb +1 -8
- data/modules/mu/{clouds → providers}/google/firewall_rule.rb +2 -2
- data/modules/mu/{clouds → providers}/google/folder.rb +4 -8
- data/modules/mu/{clouds → providers}/google/function.rb +3 -3
- data/modules/mu/{clouds → providers}/google/group.rb +8 -16
- data/modules/mu/{clouds → providers}/google/habitat.rb +3 -7
- data/modules/mu/{clouds → providers}/google/loadbalancer.rb +1 -1
- data/modules/mu/{clouds → providers}/google/role.rb +42 -34
- data/modules/mu/{clouds → providers}/google/server.rb +25 -10
- data/modules/mu/{clouds → providers}/google/server_pool.rb +10 -10
- data/modules/mu/{clouds → providers}/google/user.rb +31 -21
- data/modules/mu/{clouds → providers}/google/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/google/vpc.rb +37 -2
- data/modules/tests/centos6.yaml +11 -0
- data/modules/tests/centos7.yaml +11 -0
- data/modules/tests/centos8.yaml +12 -0
- data/modules/tests/rds.yaml +108 -0
- data/modules/tests/regrooms/rds.yaml +123 -0
- data/spec/mu/clouds/azure_spec.rb +2 -2
- metadata +108 -89
- data/modules/mu/clouds/aws/database.rb +0 -1974
data/modules/mu/config/folder.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/folder.rb
|
|
18
18
|
class Folder
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Folder
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/function.rb
|
|
18
18
|
class Function
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Function
|
data/modules/mu/config/group.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/group.rb
|
|
18
18
|
class Group
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Group
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/project.rb
|
|
18
18
|
class Habitat
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Habitat
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/loadbalancer.rb
|
|
18
18
|
class LoadBalancer
|
|
19
19
|
|
|
20
20
|
# Generate schema for a LoadBalancer health check
|
|
@@ -64,6 +64,45 @@ module MU
|
|
|
64
64
|
}
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# Generate schema for a LoadBalancer redirect
|
|
68
|
+
# @return [Hash]
|
|
69
|
+
def self.redirect
|
|
70
|
+
{
|
|
71
|
+
"type" => "object",
|
|
72
|
+
"title" => "redirect",
|
|
73
|
+
"additionalProperties" => false,
|
|
74
|
+
"description" => "Instruct our LoadBalancer to redirect traffic to another host, port, and/or path.",
|
|
75
|
+
"properties" => {
|
|
76
|
+
"protocol" => {
|
|
77
|
+
"type" => "string",
|
|
78
|
+
"default" => "HTTPS"
|
|
79
|
+
},
|
|
80
|
+
"port" => {
|
|
81
|
+
"type" => "integer",
|
|
82
|
+
"default" => 443
|
|
83
|
+
},
|
|
84
|
+
"host" => {
|
|
85
|
+
"type" => "string",
|
|
86
|
+
"default" => "\#{host}"
|
|
87
|
+
},
|
|
88
|
+
"path" => {
|
|
89
|
+
"type" => "string",
|
|
90
|
+
"default" => "/\#{path}"
|
|
91
|
+
},
|
|
92
|
+
"query" => {
|
|
93
|
+
"type" => "string",
|
|
94
|
+
"default" => "\#{query}"
|
|
95
|
+
},
|
|
96
|
+
"status_code" => {
|
|
97
|
+
"type" => "integer",
|
|
98
|
+
"description" => "The HTTP status code when issuing a redirect",
|
|
99
|
+
"default" => 301,
|
|
100
|
+
"enum" => [301, 302]
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
67
106
|
# Base configuration schema for a LoadBalancer
|
|
68
107
|
# @return [Hash]
|
|
69
108
|
def self.schema
|
|
@@ -261,7 +300,7 @@ module MU
|
|
|
261
300
|
"type" => "array",
|
|
262
301
|
"items" => {
|
|
263
302
|
"type" => "object",
|
|
264
|
-
"required" => ["lb_protocol", "lb_port"
|
|
303
|
+
"required" => ["lb_protocol", "lb_port"],
|
|
265
304
|
"additionalProperties" => false,
|
|
266
305
|
"description" => "A list of port/protocols which this Load Balancer should answer.",
|
|
267
306
|
"properties" => {
|
|
@@ -279,6 +318,7 @@ module MU
|
|
|
279
318
|
"enum" => ["HTTP", "HTTPS", "TCP", "SSL", "UDP"],
|
|
280
319
|
"description" => "Specifies the load balancer transport protocol to use for routing - HTTP, HTTPS, TCP, SSL, or UDP. SSL and UDP are only valid in Google Cloud."
|
|
281
320
|
},
|
|
321
|
+
"redirect" => MU::Config::LoadBalancer.redirect,
|
|
282
322
|
"targetgroup" => {
|
|
283
323
|
"type" => "string",
|
|
284
324
|
"description" => "Which of our declared targetgroups should be the back-end for this listener's traffic"
|
|
@@ -309,14 +349,14 @@ module MU
|
|
|
309
349
|
"items" => {
|
|
310
350
|
"type" => "object",
|
|
311
351
|
"description" => "Rules to route requests to different target groups based on the request path",
|
|
312
|
-
"required" => ["
|
|
352
|
+
"required" => ["order", "conditions"],
|
|
313
353
|
"additionalProperties" => false,
|
|
314
354
|
"properties" => {
|
|
315
355
|
"conditions" => {
|
|
316
356
|
"type" => "array",
|
|
317
357
|
"items" => {
|
|
318
358
|
"type" => "object",
|
|
319
|
-
"description" => "Rule
|
|
359
|
+
"description" => "Rule conditionl; if none are specified (or if none match) the default action will be set.",
|
|
320
360
|
"required" => ["field", "values"],
|
|
321
361
|
"additionalProperties" => false,
|
|
322
362
|
"properties" => {
|
|
@@ -339,16 +379,17 @@ module MU
|
|
|
339
379
|
"type" => "array",
|
|
340
380
|
"items" => {
|
|
341
381
|
"type" => "object",
|
|
342
|
-
"description" => "Rule action",
|
|
343
|
-
"required" => ["action"
|
|
382
|
+
"description" => "Rule action, which must specify one of +targetgroup+ or +redirect+",
|
|
383
|
+
"required" => ["action"],
|
|
344
384
|
"additionalProperties" => false,
|
|
345
385
|
"properties" => {
|
|
346
386
|
"action" => {
|
|
347
387
|
"type" => "string",
|
|
348
388
|
"default" => "forward",
|
|
349
389
|
"description" => "An action to take when a match occurs. Currently, only forwarding to a targetgroup is supported.",
|
|
350
|
-
"enum" => ["forward"]
|
|
390
|
+
"enum" => ["forward", "redirect"]
|
|
351
391
|
},
|
|
392
|
+
"redirect" => MU::Config::LoadBalancer.redirect,
|
|
352
393
|
"targetgroup" => {
|
|
353
394
|
"type" => "string",
|
|
354
395
|
"description" => "Which of our declared targetgroups should be the recipient of this traffic. If left unspecified, will default to the default targetgroup of this listener."
|
|
@@ -405,13 +446,18 @@ module MU
|
|
|
405
446
|
"proto" => l["instance_protocol"],
|
|
406
447
|
"port" => l["instance_port"]
|
|
407
448
|
}
|
|
408
|
-
if
|
|
409
|
-
|
|
410
|
-
tg["
|
|
449
|
+
if l["redirect"]
|
|
450
|
+
tg["proto"] ||= l["redirect"]["protocol"]
|
|
451
|
+
tg["port"] ||= l["redirect"]["port"]
|
|
452
|
+
end
|
|
453
|
+
l['healthcheck'] ||= lb['healthcheck'] if lb['healthcheck']
|
|
454
|
+
if l["healthcheck"]
|
|
455
|
+
hc_target = l['healthcheck']['target'].match(/^([^:]+):(\d+)(.*)/)
|
|
456
|
+
tg["healthcheck"] = l['healthcheck'].dup
|
|
411
457
|
proto = ["HTTP", "HTTPS"].include?(hc_target[1]) ? hc_target[1] : l["instance_protocol"]
|
|
412
458
|
tg['healthcheck']['target'] = "#{proto}:#{hc_target[2]}#{hc_target[3]}"
|
|
413
459
|
tg['healthcheck']["httpcode"] = "200,301,302"
|
|
414
|
-
MU.log "Converting classic-style ELB health check target #{
|
|
460
|
+
MU.log "Converting classic-style ELB health check target #{l['healthcheck']['target']} to ALB style for target group #{tgname} (#{l["instance_protocol"]}:#{l["instance_port"]}).", details: tg['healthcheck']
|
|
415
461
|
end
|
|
416
462
|
lb["targetgroups"] << tg
|
|
417
463
|
}
|
data/modules/mu/config/log.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/log.rb
|
|
18
18
|
class Log
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Log
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/msg_queue.rb
|
|
18
18
|
class MsgQueue
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a MsgQueue
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/nosqldb.rb
|
|
18
18
|
class NoSQLDB
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Bucket
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/notifier.rb
|
|
18
18
|
class Notifier
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Notifier
|
data/modules/mu/config/ref.rb
CHANGED
|
@@ -130,6 +130,23 @@ module MU
|
|
|
130
130
|
self.to_s <=> other.to_s
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
+
# Lets callers access us like a {Hash}
|
|
134
|
+
# @param attribute [String,Symbol]
|
|
135
|
+
def [](attribute)
|
|
136
|
+
if respond_to?(attribute.to_sym)
|
|
137
|
+
send(attribute.to_sym)
|
|
138
|
+
else
|
|
139
|
+
nil
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Unset an attribute. Sort of. We can't actually do that, so nil it out
|
|
144
|
+
# and we get the behavior we want.
|
|
145
|
+
def delete(attribute)
|
|
146
|
+
attribute = ("@"+attribute).to_sym if attribute.to_s !~ /^@/
|
|
147
|
+
instance_variable_set(attribute.to_sym, nil)
|
|
148
|
+
end
|
|
149
|
+
|
|
133
150
|
# Base configuration schema for declared kittens referencing other cloud objects. This is essentially a set of filters that we're going to pass to {MU::MommaCat.findStray}.
|
|
134
151
|
# @param aliases [Array<Hash>]: Key => value mappings to set backwards-compatibility aliases for attributes, such as the ubiquitous +vpc_id+ (+vpc_id+ => +id+).
|
|
135
152
|
# @return [Hash]
|
|
@@ -249,8 +266,9 @@ module MU
|
|
|
249
266
|
# called in a live deploy, which is to say that if called during initial
|
|
250
267
|
# configuration parsing, results may be incorrect.
|
|
251
268
|
# @param mommacat [MU::MommaCat]: A deploy object which will be searched for the referenced resource if provided, before restoring to broader, less efficient searches.
|
|
252
|
-
def kitten(mommacat = @mommacat, shallow: false)
|
|
269
|
+
def kitten(mommacat = @mommacat, shallow: false, debug: false)
|
|
253
270
|
return nil if !@cloud or !@type
|
|
271
|
+
loglevel = debug ? MU::NOTICE : MU::DEBUG
|
|
254
272
|
|
|
255
273
|
if @obj
|
|
256
274
|
@deploy_id ||= @obj.deploy_id
|
|
@@ -259,8 +277,16 @@ module MU
|
|
|
259
277
|
return @obj
|
|
260
278
|
end
|
|
261
279
|
|
|
262
|
-
if mommacat
|
|
263
|
-
|
|
280
|
+
if mommacat and !caller.grep(/`findLitterMate'/) # XXX the dumbest
|
|
281
|
+
MU.log "Looking for #{@type} #{@name} #{@id} in deploy #{mommacat.deploy_id}", loglevel
|
|
282
|
+
begin
|
|
283
|
+
@obj = mommacat.findLitterMate(type: @type, name: @name, cloud_id: @id, credentials: @credentials, debug: debug)
|
|
284
|
+
rescue StandardError => e
|
|
285
|
+
if e.message =~ /deadlock/
|
|
286
|
+
MU.log "Saw a recursive deadlock trying to fetch kitten for Ref object in deploy #{mmommacat.deploy_id}", MU::ERR, details: to_h
|
|
287
|
+
end
|
|
288
|
+
raise e
|
|
289
|
+
end
|
|
264
290
|
if @obj # initialize missing attributes, if we can
|
|
265
291
|
@id ||= @obj.cloud_id
|
|
266
292
|
@mommacat ||= mommacat
|
|
@@ -283,7 +309,7 @@ end
|
|
|
283
309
|
end
|
|
284
310
|
end
|
|
285
311
|
|
|
286
|
-
if !@obj and !(@cloud == "Google" and @id and @type == "users" and MU::Cloud
|
|
312
|
+
if !@obj and !(@cloud == "Google" and @id and @type == "users" and MU::Cloud.resourceClass("Google", "User").cannedServiceAcctName?(@id)) and !shallow
|
|
287
313
|
try_deploy_id = @deploy_id
|
|
288
314
|
|
|
289
315
|
begin
|
data/modules/mu/config/role.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/role.rb
|
|
18
18
|
class Role
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Group
|
|
@@ -22,10 +22,9 @@ module MU
|
|
|
22
22
|
def self.defaultCloud
|
|
23
23
|
configured = {}
|
|
24
24
|
MU::Cloud.supportedClouds.each { |cloud|
|
|
25
|
-
cloudclass = Object.const_get("MU").const_get("Cloud").const_get(cloud)
|
|
26
25
|
if $MU_CFG[cloud.downcase] and !$MU_CFG[cloud.downcase].empty?
|
|
27
26
|
configured[cloud] = $MU_CFG[cloud.downcase].size
|
|
28
|
-
configured[cloud] += 0.5 if
|
|
27
|
+
configured[cloud] += 0.5 if MU::Cloud.cloudClass(cloud).hosted? # tiebreaker
|
|
29
28
|
end
|
|
30
29
|
}
|
|
31
30
|
if configured.size > 0
|
|
@@ -34,8 +33,7 @@ module MU
|
|
|
34
33
|
}.first
|
|
35
34
|
else
|
|
36
35
|
MU::Cloud.supportedClouds.each { |cloud|
|
|
37
|
-
|
|
38
|
-
return cloud if cloudclass.hosted?
|
|
36
|
+
return cloud if MU::Cloud.cloudClass(cloud).hosted?
|
|
39
37
|
}
|
|
40
38
|
return MU::Cloud.supportedClouds.first
|
|
41
39
|
end
|
|
@@ -83,9 +81,8 @@ module MU
|
|
|
83
81
|
@@loadfails = []
|
|
84
82
|
MU::Cloud.availableClouds.each { |cloud|
|
|
85
83
|
next if @@loadfails.include?(cloud)
|
|
86
|
-
cloudclass = Object.const_get("MU").const_get("Cloud").const_get(cloud)
|
|
87
84
|
begin
|
|
88
|
-
regions =
|
|
85
|
+
regions = MU::Cloud.cloudClass(cloud).listRegions()
|
|
89
86
|
@@allregions.concat(regions) if regions
|
|
90
87
|
rescue MU::MuError => e
|
|
91
88
|
@@loadfails << cloud
|
|
@@ -100,7 +97,7 @@ module MU
|
|
|
100
97
|
@@allregions = []
|
|
101
98
|
MU::Cloud.availableClouds.each { |cloud|
|
|
102
99
|
next if @@loadfails.include?(cloud)
|
|
103
|
-
cloudclass =
|
|
100
|
+
cloudclass = MU::Cloud.cloudClass(cloud)
|
|
104
101
|
begin
|
|
105
102
|
return @@allregions if !cloudclass.listRegions()
|
|
106
103
|
@@allregions.concat(cloudclass.listRegions())
|
|
@@ -178,27 +175,27 @@ module MU
|
|
|
178
175
|
{
|
|
179
176
|
"type" => "array",
|
|
180
177
|
"items" => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
178
|
+
"type" => "object",
|
|
179
|
+
"description" => "Declare other objects which this resource requires. This resource will wait until the others are available to create itself.",
|
|
180
|
+
"required" => ["name", "type"],
|
|
181
|
+
"additionalProperties" => false,
|
|
182
|
+
"properties" => {
|
|
183
|
+
"name" => {"type" => "string"},
|
|
184
|
+
"type" => {
|
|
185
|
+
"type" => "string",
|
|
186
|
+
"enum" => MU::Cloud.resource_types.values.map { |v| v[:cfg_name] }
|
|
187
|
+
},
|
|
188
|
+
"phase" => {
|
|
189
|
+
"type" => "string",
|
|
190
|
+
"description" => "Which part of the creation process of the resource we depend on should we wait for before starting our own creation? Defaults are usually sensible, but sometimes you want, say, a Server to wait on another Server to be completely ready (through its groom phase) before starting up.",
|
|
191
|
+
"enum" => ["create", "groom"]
|
|
192
|
+
},
|
|
193
|
+
"no_create_wait" => {
|
|
194
|
+
"type" => "boolean",
|
|
195
|
+
"default" => false,
|
|
196
|
+
"description" => "By default, it's assumed that we want to wait on our parents' creation phase, in addition to whatever is declared in this stanza. Setting this flag will bypass waiting on our parent resource's creation, so that our create or groom phase can instead depend only on the parent's groom phase. "
|
|
201
197
|
}
|
|
198
|
+
}
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
201
|
end
|
|
@@ -244,7 +241,7 @@ module MU
|
|
|
244
241
|
schema["title"] = type.to_s
|
|
245
242
|
|
|
246
243
|
if cloud
|
|
247
|
-
cloudclass =
|
|
244
|
+
cloudclass = MU::Cloud.resourceClass(cloud, type)
|
|
248
245
|
|
|
249
246
|
if cloudclass.respond_to?(:schema)
|
|
250
247
|
_reqd, cloudschema = cloudclass.schema
|
|
@@ -298,11 +295,10 @@ module MU
|
|
|
298
295
|
# schema information so that we set those defaults correctly.
|
|
299
296
|
realschema = if type and schema_chunk["items"] and schema_chunk["items"]["properties"] and item["cloud"] and MU::Cloud.supportedClouds.include?(item['cloud'])
|
|
300
297
|
|
|
301
|
-
|
|
302
|
-
_toplevel_required, cloudschema = cloudclass.schema(self)
|
|
298
|
+
_toplevel_required, cloudschema = MU::Cloud.resourceClass(item["cloud"], type).schema(self)
|
|
303
299
|
|
|
304
300
|
newschema = schema_chunk["items"].dup
|
|
305
|
-
newschema["properties"]
|
|
301
|
+
MU::Config.schemaMerge(newschema["properties"], cloudschema, item["cloud"])
|
|
306
302
|
newschema
|
|
307
303
|
else
|
|
308
304
|
schema_chunk["items"].dup
|
|
@@ -339,9 +335,9 @@ module MU
|
|
|
339
335
|
return
|
|
340
336
|
end
|
|
341
337
|
|
|
342
|
-
cloudclass =
|
|
343
|
-
|
|
344
|
-
resclass =
|
|
338
|
+
cloudclass = MU::Cloud.cloudClass(kitten['cloud'])
|
|
339
|
+
|
|
340
|
+
resclass = MU::Cloud.resourceClass(kitten['cloud'], type)
|
|
345
341
|
|
|
346
342
|
schema_fields = ["us_only", "scrub_mu_isms", "credentials", "billing_acct"]
|
|
347
343
|
if !resclass.isGlobal?
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/search_domain.rb
|
|
18
18
|
class SearchDomain
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a SearchDomain
|
data/modules/mu/config/server.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/server.rb
|
|
18
18
|
class Server
|
|
19
19
|
|
|
20
20
|
# Verify that a server or server_pool has a valid LDAP config referencing
|
|
@@ -650,20 +650,12 @@ module MU
|
|
|
650
650
|
end
|
|
651
651
|
|
|
652
652
|
if !server["vpc"]["subnet_name"].nil? and configurator.nat_routes.has_key?(server["vpc"]["subnet_name"]) and !configurator.nat_routes[server["vpc"]["subnet_name"]].empty?
|
|
653
|
-
server["
|
|
654
|
-
"type" => "server",
|
|
655
|
-
"name" => configurator.nat_routes[server["vpc"]["subnet_name"]],
|
|
656
|
-
"phase" => "groom"
|
|
657
|
-
}
|
|
653
|
+
MU::Config.addDependency(server, configurator.nat_routes[server["vpc"]["subnet_name"]], "server", phase: "groom", no_create_wait: true)
|
|
658
654
|
elsif !server["vpc"]["name"].nil?
|
|
659
655
|
siblingvpc = configurator.haveLitterMate?(server["vpc"]["name"], "vpcs")
|
|
660
656
|
if siblingvpc and siblingvpc['bastion'] and
|
|
661
|
-
server['name'] != siblingvpc['bastion']
|
|
662
|
-
server["
|
|
663
|
-
"type" => "server",
|
|
664
|
-
"name" => siblingvpc['bastion'].to_h['name'],
|
|
665
|
-
"phase" => "groom"
|
|
666
|
-
}
|
|
657
|
+
server['name'] != siblingvpc['bastion']['name']
|
|
658
|
+
MU::Config.addDependency(server, siblingvpc['bastion']['name'], "server", phase: "groom", no_create_wait: true)
|
|
667
659
|
end
|
|
668
660
|
end
|
|
669
661
|
end
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/server_pool.rb
|
|
18
18
|
class ServerPool
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a ServerPool
|
|
@@ -186,11 +186,7 @@ module MU
|
|
|
186
186
|
|
|
187
187
|
if !pool["vpc"].nil?
|
|
188
188
|
if !pool["vpc"]["subnet_name"].nil? and configurator.nat_routes.has_key?(pool["vpc"]["subnet_name"])
|
|
189
|
-
pool["
|
|
190
|
-
"type" => "pool",
|
|
191
|
-
"name" => configurator.nat_routes[pool["vpc"]["subnet_name"]],
|
|
192
|
-
"phase" => "groom"
|
|
193
|
-
}
|
|
189
|
+
MU::Config.addDependency(pool, configurator.nat_routes[pool["vpc"]["subnet_name"]], "server", phase: "groom", no_create_wait: true)
|
|
194
190
|
end
|
|
195
191
|
end
|
|
196
192
|
# TODO make sure this is handled... somewhere
|
|
@@ -203,7 +199,7 @@ module MU
|
|
|
203
199
|
# }
|
|
204
200
|
# end
|
|
205
201
|
if pool["basis"] and pool["basis"]["server"]
|
|
206
|
-
pool["
|
|
202
|
+
MU::Config.addDependency(pool, pool["basis"]["server"], "server", phase: "groom")
|
|
207
203
|
end
|
|
208
204
|
if !pool['static_ip'].nil? and !pool['ip'].nil?
|
|
209
205
|
ok = false
|