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.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mu-adopt +4 -12
  3. data/bin/mu-azure-tests +57 -0
  4. data/bin/mu-cleanup +2 -4
  5. data/bin/mu-configure +37 -1
  6. data/bin/mu-deploy +3 -3
  7. data/bin/mu-findstray-tests +25 -0
  8. data/bin/mu-gen-docs +2 -4
  9. data/bin/mu-run-tests +23 -10
  10. data/cloud-mu.gemspec +2 -2
  11. data/cookbooks/mu-tools/libraries/helper.rb +1 -1
  12. data/cookbooks/mu-tools/recipes/apply_security.rb +14 -14
  13. data/cookbooks/mu-tools/recipes/aws_api.rb +9 -0
  14. data/extras/generate-stock-images +1 -0
  15. data/modules/mu.rb +82 -95
  16. data/modules/mu/adoption.rb +356 -56
  17. data/modules/mu/cleanup.rb +21 -20
  18. data/modules/mu/cloud.rb +79 -1753
  19. data/modules/mu/cloud/database.rb +49 -0
  20. data/modules/mu/cloud/dnszone.rb +46 -0
  21. data/modules/mu/cloud/machine_images.rb +212 -0
  22. data/modules/mu/cloud/providers.rb +81 -0
  23. data/modules/mu/cloud/resource_base.rb +920 -0
  24. data/modules/mu/cloud/server.rb +40 -0
  25. data/modules/mu/cloud/server_pool.rb +1 -0
  26. data/modules/mu/cloud/ssh_sessions.rb +228 -0
  27. data/modules/mu/cloud/winrm_sessions.rb +237 -0
  28. data/modules/mu/cloud/wrappers.rb +165 -0
  29. data/modules/mu/config.rb +122 -80
  30. data/modules/mu/config/alarm.rb +2 -6
  31. data/modules/mu/config/bucket.rb +1 -1
  32. data/modules/mu/config/cache_cluster.rb +1 -1
  33. data/modules/mu/config/collection.rb +1 -1
  34. data/modules/mu/config/container_cluster.rb +2 -2
  35. data/modules/mu/config/database.rb +83 -104
  36. data/modules/mu/config/database.yml +1 -2
  37. data/modules/mu/config/dnszone.rb +1 -1
  38. data/modules/mu/config/doc_helpers.rb +4 -5
  39. data/modules/mu/config/endpoint.rb +1 -1
  40. data/modules/mu/config/firewall_rule.rb +3 -19
  41. data/modules/mu/config/folder.rb +1 -1
  42. data/modules/mu/config/function.rb +1 -1
  43. data/modules/mu/config/group.rb +1 -1
  44. data/modules/mu/config/habitat.rb +1 -1
  45. data/modules/mu/config/loadbalancer.rb +57 -11
  46. data/modules/mu/config/log.rb +1 -1
  47. data/modules/mu/config/msg_queue.rb +1 -1
  48. data/modules/mu/config/nosqldb.rb +1 -1
  49. data/modules/mu/config/notifier.rb +1 -1
  50. data/modules/mu/config/ref.rb +30 -4
  51. data/modules/mu/config/role.rb +1 -1
  52. data/modules/mu/config/schema_helpers.rb +30 -34
  53. data/modules/mu/config/search_domain.rb +1 -1
  54. data/modules/mu/config/server.rb +4 -12
  55. data/modules/mu/config/server_pool.rb +3 -7
  56. data/modules/mu/config/storage_pool.rb +1 -1
  57. data/modules/mu/config/tail.rb +10 -0
  58. data/modules/mu/config/user.rb +1 -1
  59. data/modules/mu/config/vpc.rb +12 -17
  60. data/modules/mu/defaults/AWS.yaml +32 -32
  61. data/modules/mu/defaults/Azure.yaml +1 -0
  62. data/modules/mu/defaults/Google.yaml +1 -0
  63. data/modules/mu/deploy.rb +16 -15
  64. data/modules/mu/groomer.rb +15 -0
  65. data/modules/mu/groomers/chef.rb +3 -0
  66. data/modules/mu/logger.rb +120 -144
  67. data/modules/mu/master.rb +1 -1
  68. data/modules/mu/mommacat.rb +54 -25
  69. data/modules/mu/mommacat/daemon.rb +10 -7
  70. data/modules/mu/mommacat/naming.rb +82 -3
  71. data/modules/mu/mommacat/search.rb +47 -15
  72. data/modules/mu/mommacat/storage.rb +72 -41
  73. data/modules/mu/{clouds → providers}/README.md +1 -1
  74. data/modules/mu/{clouds → providers}/aws.rb +114 -47
  75. data/modules/mu/{clouds → providers}/aws/alarm.rb +1 -1
  76. data/modules/mu/{clouds → providers}/aws/bucket.rb +2 -2
  77. data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +10 -46
  78. data/modules/mu/{clouds → providers}/aws/collection.rb +3 -3
  79. data/modules/mu/{clouds → providers}/aws/container_cluster.rb +15 -33
  80. data/modules/mu/providers/aws/database.rb +1744 -0
  81. data/modules/mu/{clouds → providers}/aws/dnszone.rb +2 -5
  82. data/modules/mu/{clouds → providers}/aws/endpoint.rb +2 -11
  83. data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +33 -29
  84. data/modules/mu/{clouds → providers}/aws/folder.rb +0 -0
  85. data/modules/mu/{clouds → providers}/aws/function.rb +2 -10
  86. data/modules/mu/{clouds → providers}/aws/group.rb +9 -13
  87. data/modules/mu/{clouds → providers}/aws/habitat.rb +1 -1
  88. data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +41 -33
  89. data/modules/mu/{clouds → providers}/aws/log.rb +2 -2
  90. data/modules/mu/{clouds → providers}/aws/msg_queue.rb +2 -8
  91. data/modules/mu/{clouds → providers}/aws/nosqldb.rb +0 -0
  92. data/modules/mu/{clouds → providers}/aws/notifier.rb +0 -0
  93. data/modules/mu/{clouds → providers}/aws/role.rb +7 -7
  94. data/modules/mu/{clouds → providers}/aws/search_domain.rb +8 -13
  95. data/modules/mu/{clouds → providers}/aws/server.rb +55 -90
  96. data/modules/mu/{clouds → providers}/aws/server_pool.rb +10 -33
  97. data/modules/mu/{clouds → providers}/aws/storage_pool.rb +19 -36
  98. data/modules/mu/{clouds → providers}/aws/user.rb +8 -12
  99. data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
  100. data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +0 -0
  101. data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
  102. data/modules/mu/{clouds → providers}/aws/vpc.rb +135 -70
  103. data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
  104. data/modules/mu/{clouds → providers}/azure.rb +4 -1
  105. data/modules/mu/{clouds → providers}/azure/container_cluster.rb +1 -5
  106. data/modules/mu/{clouds → providers}/azure/firewall_rule.rb +8 -1
  107. data/modules/mu/{clouds → providers}/azure/habitat.rb +0 -0
  108. data/modules/mu/{clouds → providers}/azure/loadbalancer.rb +0 -0
  109. data/modules/mu/{clouds → providers}/azure/role.rb +0 -0
  110. data/modules/mu/{clouds → providers}/azure/server.rb +30 -23
  111. data/modules/mu/{clouds → providers}/azure/user.rb +1 -1
  112. data/modules/mu/{clouds → providers}/azure/userdata/README.md +0 -0
  113. data/modules/mu/{clouds → providers}/azure/userdata/linux.erb +0 -0
  114. data/modules/mu/{clouds → providers}/azure/userdata/windows.erb +0 -0
  115. data/modules/mu/{clouds → providers}/azure/vpc.rb +4 -6
  116. data/modules/mu/{clouds → providers}/cloudformation.rb +1 -1
  117. data/modules/mu/{clouds → providers}/cloudformation/alarm.rb +3 -3
  118. data/modules/mu/{clouds → providers}/cloudformation/cache_cluster.rb +3 -3
  119. data/modules/mu/{clouds → providers}/cloudformation/collection.rb +3 -3
  120. data/modules/mu/{clouds → providers}/cloudformation/database.rb +6 -17
  121. data/modules/mu/{clouds → providers}/cloudformation/dnszone.rb +3 -3
  122. data/modules/mu/{clouds → providers}/cloudformation/firewall_rule.rb +3 -3
  123. data/modules/mu/{clouds → providers}/cloudformation/loadbalancer.rb +3 -3
  124. data/modules/mu/{clouds → providers}/cloudformation/log.rb +3 -3
  125. data/modules/mu/{clouds → providers}/cloudformation/server.rb +7 -7
  126. data/modules/mu/{clouds → providers}/cloudformation/server_pool.rb +5 -5
  127. data/modules/mu/{clouds → providers}/cloudformation/vpc.rb +3 -3
  128. data/modules/mu/{clouds → providers}/docker.rb +0 -0
  129. data/modules/mu/{clouds → providers}/google.rb +14 -6
  130. data/modules/mu/{clouds → providers}/google/bucket.rb +1 -1
  131. data/modules/mu/{clouds → providers}/google/container_cluster.rb +28 -13
  132. data/modules/mu/{clouds → providers}/google/database.rb +1 -8
  133. data/modules/mu/{clouds → providers}/google/firewall_rule.rb +2 -2
  134. data/modules/mu/{clouds → providers}/google/folder.rb +4 -8
  135. data/modules/mu/{clouds → providers}/google/function.rb +3 -3
  136. data/modules/mu/{clouds → providers}/google/group.rb +8 -16
  137. data/modules/mu/{clouds → providers}/google/habitat.rb +3 -7
  138. data/modules/mu/{clouds → providers}/google/loadbalancer.rb +1 -1
  139. data/modules/mu/{clouds → providers}/google/role.rb +42 -34
  140. data/modules/mu/{clouds → providers}/google/server.rb +25 -10
  141. data/modules/mu/{clouds → providers}/google/server_pool.rb +10 -10
  142. data/modules/mu/{clouds → providers}/google/user.rb +31 -21
  143. data/modules/mu/{clouds → providers}/google/userdata/README.md +0 -0
  144. data/modules/mu/{clouds → providers}/google/userdata/linux.erb +0 -0
  145. data/modules/mu/{clouds → providers}/google/userdata/windows.erb +0 -0
  146. data/modules/mu/{clouds → providers}/google/vpc.rb +37 -2
  147. data/modules/tests/centos6.yaml +11 -0
  148. data/modules/tests/centos7.yaml +11 -0
  149. data/modules/tests/centos8.yaml +12 -0
  150. data/modules/tests/rds.yaml +108 -0
  151. data/modules/tests/regrooms/rds.yaml +123 -0
  152. data/spec/mu/clouds/azure_spec.rb +2 -2
  153. metadata +108 -89
  154. data/modules/mu/clouds/aws/database.rb +0 -1974
@@ -218,11 +218,7 @@ module MU
218
218
  "Azure Kubernetes Service Cluster Admin Role"
219
219
  ]
220
220
  }
221
- cluster['dependencies'] ||= []
222
- cluster['dependencies'] << {
223
- "type" => "user",
224
- "name" => cluster["name"]+"user"
225
- }
221
+ MU::Config.addDependency(cluster, cluster['name']+"user", "user")
226
222
 
227
223
  ok = false if !configurator.insertKitten(svcacct_desc, "users")
228
224
 
@@ -337,7 +337,14 @@ module MU
337
337
  # We assume that any values we have in +@config+ are placeholders, and
338
338
  # calculate our own accordingly based on what's live in the cloud.
339
339
  def toKitten(**args)
340
- bok = {}
340
+
341
+ bok = {
342
+ "cloud" => "Azure",
343
+ "name" => cloud_desc.name,
344
+ "project" => @config['project'],
345
+ "credentials" => @config['credentials'],
346
+ "cloud_id" => @cloud_id.to_s
347
+ }
341
348
 
342
349
  bok
343
350
  end
@@ -146,7 +146,7 @@ module MU
146
146
  return nil if @config.nil? or @deploy.nil?
147
147
 
148
148
  nat_ssh_key = nat_ssh_user = nat_ssh_host = nil
149
- if !@config["vpc"].nil? and !MU::Cloud::Azure::VPC.haveRouteToInstance?(cloud_desc, region: @config['region'], credentials: @config['credentials'])
149
+ if !@config["vpc"].nil? and !MU::Cloud.resourceClass("Azure", "VPC").haveRouteToInstance?(cloud_desc, region: @config['region'], credentials: @config['credentials'])
150
150
 
151
151
  if !@nat.nil? and @nat.mu_name != @mu_name
152
152
  if @nat.cloud_desc.nil?
@@ -189,7 +189,7 @@ module MU
189
189
  end
190
190
 
191
191
  _nat_ssh_key, _nat_ssh_user, nat_ssh_host, _canonical_ip, _ssh_user, _ssh_key_name = getSSHConfig
192
- if !nat_ssh_host and !MU::Cloud::Azure::VPC.haveRouteToInstance?(cloud_desc, region: @config['region'], credentials: @config['credentials'])
192
+ if !nat_ssh_host and !MU::Cloud.resourceClass("Azure", "VPC").haveRouteToInstance?(cloud_desc, region: @config['region'], credentials: @config['credentials'])
193
193
  # XXX check if canonical_ip is in the private ranges
194
194
  # raise MuError, "#{node} has no NAT host configured, and I have no other route to it"
195
195
  end
@@ -384,7 +384,7 @@ module MU
384
384
  # Our deploydata gets corrupted often with server pools, this will cause us to use the wrong IP to identify a node
385
385
  # which will cause us to create certificates, DNS records and other artifacts with incorrect information which will cause our deploy to fail.
386
386
  # The cloud_id is always correct so lets use 'cloud_desc' to get the correct IPs
387
- if MU::Cloud::Azure::VPC.haveRouteToInstance?(cloud_desc, credentials: @config['credentials']) or public_ips.size == 0
387
+ if MU::Cloud.resourceClass("Azure", "VPC").haveRouteToInstance?(cloud_desc, credentials: @config['credentials']) or public_ips.size == 0
388
388
  @config['canonical_ip'] = private_ips.first
389
389
  return private_ips.first
390
390
  else
@@ -393,6 +393,28 @@ module MU
393
393
  end
394
394
  end
395
395
 
396
+ # Return all of the IP addresses, public and private, from all of our
397
+ # network interfaces.
398
+ # @return [Array<String>]
399
+ def listIPs
400
+ ips = []
401
+ cloud_desc.network_profile.network_interfaces.each { |iface|
402
+ iface_id = Id.new(iface.is_a?(Hash) ? iface['id'] : iface.id)
403
+ iface_desc = MU::Cloud::Azure.network(credentials: @credentials).network_interfaces.get(@resource_group, iface_id.to_s)
404
+ iface_desc.ip_configurations.each { |ipcfg|
405
+ ips << ipcfg.private_ipaddress
406
+ if ipcfg.respond_to?(:public_ipaddress) and ipcfg.public_ipaddress
407
+ ip_id = Id.new(ipcfg.public_ipaddress.id)
408
+ ip_desc = MU::Cloud::Azure.network(credentials: @credentials).public_ipaddresses.get(@resource_group, ip_id.to_s)
409
+ if ip_desc
410
+ ips << ip_desc.ip_address
411
+ end
412
+ end
413
+ }
414
+ }
415
+ ips
416
+ end
417
+
396
418
  # return [String]: A password string.
397
419
  def getWindowsAdminPassword
398
420
  end
@@ -441,7 +463,7 @@ module MU
441
463
  hosts_schema = MU::Config::CIDR_PRIMITIVE
442
464
  hosts_schema["pattern"] = "^(\\d+\\.\\d+\\.\\d+\\.\\d+\/[0-9]{1,2}|\\*)$"
443
465
  schema = {
444
- "roles" => MU::Cloud::Azure::User.schema(config)[1]["roles"],
466
+ "roles" => MU::Cloud.resourceClass("Azure", "User").schema(config)[1]["roles"],
445
467
  "ingress_rules" => {
446
468
  "items" => {
447
469
  "properties" => {
@@ -497,8 +519,7 @@ module MU
497
519
  foundmatch = false
498
520
  MU::Cloud.availableClouds.each { |cloud|
499
521
  next if cloud == "Azure"
500
- cloudbase = Object.const_get("MU").const_get("Cloud").const_get(cloud)
501
- foreign_types = (cloudbase.listInstanceTypes).values.first
522
+ foreign_types = (MU::Cloud.cloudClass(cloud).listInstanceTypes).values.first
502
523
  if foreign_types.size == 1
503
524
  foreign_types = foreign_types.values.first
504
525
  end
@@ -590,18 +611,8 @@ module MU
590
611
  if !configurator.insertKitten(vpc, "vpcs", true)
591
612
  ok = false
592
613
  end
593
- server['dependencies'] ||= []
594
-
595
- server['dependencies'] << {
596
- "type" => "vpc",
597
- "name" => server['name']+"vpc"
598
- }
599
- # XXX what happens if there's no natstion here?
600
- server['dependencies'] << {
601
- "type" => "server",
602
- "name" => server['name']+"vpc-natstion",
603
- "phase" => "groom"
604
- }
614
+ MU::Config.addDependency(server, server['name']+"vpc", "vpc")
615
+ MU::Config.addDependency(server, server['name']+"vpc-natstion", "server", phase: "groom")
605
616
  server['vpc'] = {
606
617
  "name" => server['name']+"vpc",
607
618
  "subnet_pref" => "private"
@@ -618,11 +629,7 @@ module MU
618
629
  "credentials" => server["credentials"],
619
630
  "roles" => server["roles"]
620
631
  }
621
- server['dependencies'] ||= []
622
- server['dependencies'] << {
623
- "type" => "user",
624
- "name" => server["name"]+"user"
625
- }
632
+ MU::Config.addDependency(server, server['name']+"user", "user")
626
633
 
627
634
  ok = false if !configurator.insertKitten(svcacct_desc, "users")
628
635
 
@@ -107,7 +107,7 @@ module MU
107
107
  def groom
108
108
  if @config['roles']
109
109
  @config['roles'].each { |role|
110
- MU::Cloud::Azure::Role.assignTo(cloud_desc.principal_id, role_name: role, credentials: @config['credentials'])
110
+ MU::Cloud.resourceClass("Azure", "Role").assignTo(cloud_desc.principal_id, role_name: role, credentials: @config['credentials'])
111
111
  }
112
112
  end
113
113
  end
@@ -335,8 +335,10 @@ module MU
335
335
  return nil if cloud_desc.name == "default" # parent project builds these
336
336
  bok = {
337
337
  "cloud" => "Azure",
338
+ "name" => cloud_desc.name,
338
339
  "project" => @config['project'],
339
- "credentials" => @config['credentials']
340
+ "credentials" => @config['credentials'],
341
+ "cloud_id" => @cloud_id.to_s
340
342
  }
341
343
 
342
344
  bok
@@ -424,11 +426,7 @@ module MU
424
426
  }
425
427
  ]
426
428
  }
427
- vpc["dependencies"] ||= []
428
- vpc["dependencies"] << {
429
- "type" => "firewall_rule",
430
- "name" => vpc['name']+"-defaultfw"
431
- }
429
+ MU::Config.addDependency(vpc, vpc['name']+"-defaultfw", "firewall_rule")
432
430
 
433
431
  if !configurator.insertKitten(default_acl, "firewall_rules", true)
434
432
  ok = false
@@ -34,7 +34,7 @@ module MU
34
34
  end
35
35
 
36
36
  # List all AWS projects available to our credentials
37
- def self.listHabitats(credentials = nil)
37
+ def self.listHabitats(credentials = nil, use_cache: true)
38
38
  MU::Cloud::AWS.listHabitats(credentials)
39
39
  end
40
40
 
@@ -129,7 +129,7 @@ module MU
129
129
  # @param config [MU::Config]: The calling MU::Config object
130
130
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
131
131
  def self.schema(config)
132
- MU::Cloud::AWS::Alarm.schema(config)
132
+ MU::Cloud.resourceClass("AWS", "Alarm").schema(config)
133
133
  end
134
134
 
135
135
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -137,14 +137,14 @@ module MU
137
137
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
138
138
  # @return [Boolean]: True if validation succeeded, False otherwise
139
139
  def self.validateConfig(server, configurator)
140
- MU::Cloud::AWS::Alarm.validateConfig(server, configurator)
140
+ MU::Cloud.resourceClass("AWS", "Alarm").validateConfig(server, configurator)
141
141
  end
142
142
 
143
143
  # Does this resource type exist as a global (cloud-wide) artifact, or
144
144
  # is it localized to a region/zone?
145
145
  # @return [Boolean]
146
146
  def self.isGlobal?
147
- MU::Cloud::AWS::Alarm.isGlobal?
147
+ MU::Cloud.resourceClass("AWS", "Alarm").isGlobal?
148
148
  end
149
149
 
150
150
 
@@ -150,7 +150,7 @@ module MU
150
150
  # @param config [MU::Config]: The calling MU::Config object
151
151
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
152
152
  def self.schema(config)
153
- MU::Cloud::AWS::CacheCluster.schema(config)
153
+ MU::Cloud.resourceClass("AWS", "CacheCluster").schema(config)
154
154
  end
155
155
 
156
156
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -158,14 +158,14 @@ module MU
158
158
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
159
159
  # @return [Boolean]: True if validation succeeded, False otherwise
160
160
  def self.validateConfig(server, configurator)
161
- MU::Cloud::AWS::CacheCluster.validateConfig(server, configurator)
161
+ MU::Cloud.resourceClass("AWS", "CacheCluster").validateConfig(server, configurator)
162
162
  end
163
163
 
164
164
  # Does this resource type exist as a global (cloud-wide) artifact, or
165
165
  # is it localized to a region/zone?
166
166
  # @return [Boolean]
167
167
  def self.isGlobal?
168
- MU::Cloud::AWS::CacheCluster.isGlobal?
168
+ MU::Cloud.resourceClass("AWS", "CacheCluster").isGlobal?
169
169
  end
170
170
 
171
171
  end
@@ -100,7 +100,7 @@ module MU
100
100
  # @param config [MU::Config]: The calling MU::Config object
101
101
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
102
102
  def self.schema(config)
103
- MU::Cloud::AWS::Collection.schema(config)
103
+ MU::Cloud.resourceClass("AWS", "Collection").schema(config)
104
104
  end
105
105
 
106
106
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -108,14 +108,14 @@ module MU
108
108
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
109
109
  # @return [Boolean]: True if validation succeeded, False otherwise
110
110
  def self.validateConfig(server, configurator)
111
- MU::Cloud::AWS::Collection.validateConfig(server, configurator)
111
+ MU::Cloud.resourceClass("AWS", "Collection").validateConfig(server, configurator)
112
112
  end
113
113
 
114
114
  # Does this resource type exist as a global (cloud-wide) artifact, or
115
115
  # is it localized to a region/zone?
116
116
  # @return [Boolean]
117
117
  def self.isGlobal?
118
- MU::Cloud::AWS::Collection.isGlobal?
118
+ MU::Cloud.resourceClass("AWS", "Collection").isGlobal?
119
119
  end
120
120
 
121
121
  end
@@ -64,8 +64,8 @@ module MU
64
64
  basename = @config["name"].to_s
65
65
  basename = basename+@deploy.timestamp+MU.seed.downcase if !@config['scrub_mu_isms']
66
66
  basename.gsub!(/[^a-z0-9]/i, "")
67
- @config["db_name"] = MU::Cloud::AWS::Database.getName(basename, type: "dbname", config: @config)
68
- @config['master_user'] = MU::Cloud::AWS::Database.getName(basename, type: "dbuser", config: @config)
67
+ @config["db_name"] = MU::Cloud.resourceClass("AWS", "Database").getName(basename, type: "dbname", config: @config)
68
+ @config['master_user'] = MU::Cloud.resourceClass("AWS", "Database").getName(basename, type: "dbuser", config: @config)
69
69
 
70
70
  if @config["create_cluster"]
71
71
  @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase("dbcluster", self, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms']) if @cfm_template.nil?
@@ -214,18 +214,7 @@ module MU
214
214
  elsif @config['db_name']
215
215
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DBName", @config['db_name'])
216
216
  end
217
- if @config['password'].nil?
218
- if @config['auth_vault'] && !@config['auth_vault'].empty?
219
- @config['password'] = @groomclass.getSecret(
220
- vault: @config['auth_vault']['vault'],
221
- item: @config['auth_vault']['item'],
222
- field: @config['auth_vault']['password_field']
223
- )
224
- else
225
- # Should we use random instead?
226
- @config['password'] = Password.pronounceable(10..12)
227
- end
228
- end
217
+ getPassword
229
218
  MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "MasterUserPassword", @config['password'])
230
219
  end
231
220
  end
@@ -260,7 +249,7 @@ module MU
260
249
  # @param config [MU::Config]: The calling MU::Config object
261
250
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
262
251
  def self.schema(config)
263
- MU::Cloud::AWS::Database.schema(config)
252
+ MU::Cloud.resourceClass("AWS", "Database").schema(config)
264
253
  end
265
254
 
266
255
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -268,14 +257,14 @@ module MU
268
257
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
269
258
  # @return [Boolean]: True if validation succeeded, False otherwise
270
259
  def self.validateConfig(server, configurator)
271
- MU::Cloud::AWS::Database.validateConfig(server, configurator)
260
+ MU::Cloud.resourceClass("AWS", "Database").validateConfig(server, configurator)
272
261
  end
273
262
 
274
263
  # Does this resource type exist as a global (cloud-wide) artifact, or
275
264
  # is it localized to a region/zone?
276
265
  # @return [Boolean]
277
266
  def self.isGlobal?
278
- MU::Cloud::AWS::Database.isGlobal?
267
+ MU::Cloud.resourceClass("AWS", "Database").isGlobal?
279
268
  end
280
269
 
281
270
 
@@ -257,7 +257,7 @@ module MU
257
257
  # @param config [MU::Config]: The calling MU::Config object
258
258
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
259
259
  def self.schema(config)
260
- MU::Cloud::AWS::DNSZone.schema(config)
260
+ MU::Cloud.resourceClass("AWS", "DNSZone").schema(config)
261
261
  end
262
262
 
263
263
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -265,14 +265,14 @@ module MU
265
265
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
266
266
  # @return [Boolean]: True if validation succeeded, False otherwise
267
267
  def self.validateConfig(server, configurator)
268
- MU::Cloud::AWS::DNSZone.validateConfig(server, configurator)
268
+ MU::Cloud.resourceClass("AWS", "DNSZone").validateConfig(server, configurator)
269
269
  end
270
270
 
271
271
  # Does this resource type exist as a global (cloud-wide) artifact, or
272
272
  # is it localized to a region/zone?
273
273
  # @return [Boolean]
274
274
  def self.isGlobal?
275
- MU::Cloud::AWS::DNSZone.isGlobal?
275
+ MU::Cloud.resourceClass("AWS", "DNSZone").isGlobal?
276
276
  end
277
277
 
278
278
  end
@@ -137,7 +137,7 @@ module MU
137
137
  # @return [Boolean]: True if validation succeeded, False otherwise
138
138
  def self.validateConfig(acl, config)
139
139
  # Just use the AWS implemention
140
- MU::Cloud::AWS::FirewallRule.validateConfig(acl, config)
140
+ MU::Cloud.resourceClass("AWS", "FirewallRule").validateConfig(acl, config)
141
141
  end
142
142
 
143
143
  private
@@ -291,14 +291,14 @@ module MU
291
291
  # @param config [MU::Config]: The calling MU::Config object
292
292
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
293
293
  def self.schema(config)
294
- MU::Cloud::AWS::FirewallRule.schema(config)
294
+ MU::Cloud.resourceClass("AWS", "FirewallRule").schema(config)
295
295
  end
296
296
 
297
297
  # Does this resource type exist as a global (cloud-wide) artifact, or
298
298
  # is it localized to a region/zone?
299
299
  # @return [Boolean]
300
300
  def self.isGlobal?
301
- MU::Cloud::AWS::FirewallRule.isGlobal?
301
+ MU::Cloud.resourceClass("AWS", "FirewallRule").isGlobal?
302
302
  end
303
303
 
304
304
  end #class
@@ -176,7 +176,7 @@ module MU
176
176
  # @param config [MU::Config]: The calling MU::Config object
177
177
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
178
178
  def self.schema(config)
179
- MU::Cloud::AWS::LoadBalancer.schema(config)
179
+ MU::Cloud.resourceClass("AWS", "LoadBalancer").schema(config)
180
180
  end
181
181
 
182
182
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -184,14 +184,14 @@ module MU
184
184
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
185
185
  # @return [Boolean]: True if validation succeeded, False otherwise
186
186
  def self.validateConfig(server, configurator)
187
- MU::Cloud::AWS::LoadBalancer.validateConfig(server, configurator)
187
+ MU::Cloud.resourceClass("AWS", "LoadBalancer").validateConfig(server, configurator)
188
188
  end
189
189
 
190
190
  # Does this resource type exist as a global (cloud-wide) artifact, or
191
191
  # is it localized to a region/zone?
192
192
  # @return [Boolean]
193
193
  def self.isGlobal?
194
- MU::Cloud::AWS::LoadBalancer.isGlobal?
194
+ MU::Cloud.resourceClass("AWS", "LoadBalancer").isGlobal?
195
195
  end
196
196
 
197
197
  end
@@ -153,7 +153,7 @@ module MU
153
153
  # @param config [MU::Config]: The calling MU::Config object
154
154
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
155
155
  def self.schema(config)
156
- MU::Cloud::AWS::Log.schema(config)
156
+ MU::Cloud.resourceClass("AWS", "Log").schema(config)
157
157
  end
158
158
 
159
159
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -161,14 +161,14 @@ module MU
161
161
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
162
162
  # @return [Boolean]: True if validation succeeded, False otherwise
163
163
  def self.validateConfig(server, configurator)
164
- MU::Cloud::AWS::Log.validateConfig(server, configurator)
164
+ MU::Cloud.resourceClass("AWS", "Log").validateConfig(server, configurator)
165
165
  end
166
166
 
167
167
  # Does this resource type exist as a global (cloud-wide) artifact, or
168
168
  # is it localized to a region/zone?
169
169
  # @return [Boolean]
170
170
  def self.isGlobal?
171
- MU::Cloud::AWS::Log.isGlobal?
171
+ MU::Cloud.resourceClass("AWS", "Log").isGlobal?
172
172
  end
173
173
 
174
174
  end
@@ -55,8 +55,8 @@ module MU
55
55
  scrub_mu_isms: @config['scrub_mu_isms']
56
56
  )
57
57
 
58
- @disk_devices = MU::Cloud::AWS::Server.disk_devices
59
- @ephemeral_mappings = MU::Cloud::AWS::Server.ephemeral_mappings
58
+ @disk_devices = MU::Cloud.resourceClass("AWS", "Server").disk_devices
59
+ @ephemeral_mappings = MU::Cloud.resourceClass("AWS", "Server").ephemeral_mappings
60
60
 
61
61
  if !mu_name.nil?
62
62
  @mu_name = mu_name
@@ -190,7 +190,7 @@ module MU
190
190
  cfm_volume_map = {}
191
191
  if @config["storage"]
192
192
  @config["storage"].each { |vol|
193
- mapping, cfm_mapping = MU::Cloud::AWS::Server.convertBlockDeviceMapping(vol)
193
+ mapping, cfm_mapping = MU::Cloud.resourceClass("AWS", "Server").convertBlockDeviceMapping(vol)
194
194
  configured_storage << mapping
195
195
  # vol_name, vol_template = MU::Cloud::CloudFormation.cloudFormationBase("volume", name: "volume"+@cfm_name+mapping[:device_name])
196
196
  # MU::Cloud::CloudFormation.setCloudFormationProp(vol_template[vol_name], "Size", mapping[:ebs][:volume_size].to_s)
@@ -353,7 +353,7 @@ module MU
353
353
  # @param config [MU::Config]: The calling MU::Config object
354
354
  # @return [Array<Array,Hash>]: List of required fields, and json-schema Hash of cloud-specific configuration parameters for this resource
355
355
  def self.schema(config)
356
- MU::Cloud::AWS::Server.schema(config)
356
+ MU::Cloud.resourceClass("AWS", "Server").schema(config)
357
357
  end
358
358
 
359
359
  # Confirm that the given instance size is valid for the given region.
@@ -362,7 +362,7 @@ module MU
362
362
  # @param region [String]: Region to check against
363
363
  # @return [String,nil]
364
364
  def self.validateInstanceType(size, region)
365
- MU::Cloud::AWS::Server.validateInstanceType(size, region)
365
+ MU::Cloud.resourceClass("AWS", "Server").validateInstanceType(size, region)
366
366
  end
367
367
 
368
368
  # Cloud-specific pre-processing of {MU::Config::BasketofKittens::servers}, bare and unvalidated.
@@ -370,14 +370,14 @@ module MU
370
370
  # @param configurator [MU::Config]: The overall deployment configurator of which this resource is a member
371
371
  # @return [Boolean]: True if validation succeeded, False otherwise
372
372
  def self.validateConfig(server, configurator)
373
- MU::Cloud::AWS::Server.validateConfig(server, configurator)
373
+ MU::Cloud.resourceClass("AWS", "Server").validateConfig(server, configurator)
374
374
  end
375
375
 
376
376
  # Does this resource type exist as a global (cloud-wide) artifact, or
377
377
  # is it localized to a region/zone?
378
378
  # @return [Boolean]
379
379
  def self.isGlobal?
380
- MU::Cloud::AWS::Server.isGlobal?
380
+ MU::Cloud.resourceClass("AWS", "Server").isGlobal?
381
381
  end
382
382
 
383
383
  end #class