cloud-mu 3.1.5 → 3.3.2

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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +5 -1
  3. data/ansible/roles/mu-windows/files/LaunchConfig.json +9 -0
  4. data/ansible/roles/mu-windows/files/config.xml +76 -0
  5. data/ansible/roles/mu-windows/tasks/main.yml +16 -0
  6. data/bin/mu-adopt +16 -12
  7. data/bin/mu-azure-tests +57 -0
  8. data/bin/mu-cleanup +2 -4
  9. data/bin/mu-configure +52 -0
  10. data/bin/mu-deploy +3 -3
  11. data/bin/mu-findstray-tests +25 -0
  12. data/bin/mu-gen-docs +2 -4
  13. data/bin/mu-load-config.rb +2 -1
  14. data/bin/mu-node-manage +15 -16
  15. data/bin/mu-run-tests +37 -12
  16. data/cloud-mu.gemspec +3 -3
  17. data/cookbooks/mu-activedirectory/resources/domain.rb +4 -4
  18. data/cookbooks/mu-activedirectory/resources/domain_controller.rb +4 -4
  19. data/cookbooks/mu-tools/libraries/helper.rb +1 -1
  20. data/cookbooks/mu-tools/recipes/apply_security.rb +14 -14
  21. data/cookbooks/mu-tools/recipes/aws_api.rb +9 -0
  22. data/cookbooks/mu-tools/recipes/eks.rb +2 -2
  23. data/cookbooks/mu-tools/recipes/windows-client.rb +25 -22
  24. data/extras/clean-stock-amis +25 -19
  25. data/extras/generate-stock-images +1 -0
  26. data/extras/image-generators/AWS/win2k12.yaml +2 -0
  27. data/extras/image-generators/AWS/win2k16.yaml +2 -0
  28. data/extras/image-generators/AWS/win2k19.yaml +2 -0
  29. data/modules/mommacat.ru +1 -1
  30. data/modules/mu.rb +86 -98
  31. data/modules/mu/adoption.rb +373 -58
  32. data/modules/mu/cleanup.rb +214 -303
  33. data/modules/mu/cloud.rb +128 -1733
  34. data/modules/mu/cloud/database.rb +49 -0
  35. data/modules/mu/cloud/dnszone.rb +44 -0
  36. data/modules/mu/cloud/machine_images.rb +212 -0
  37. data/modules/mu/cloud/providers.rb +81 -0
  38. data/modules/mu/cloud/resource_base.rb +929 -0
  39. data/modules/mu/cloud/server.rb +40 -0
  40. data/modules/mu/cloud/server_pool.rb +1 -0
  41. data/modules/mu/cloud/ssh_sessions.rb +228 -0
  42. data/modules/mu/cloud/winrm_sessions.rb +237 -0
  43. data/modules/mu/cloud/wrappers.rb +169 -0
  44. data/modules/mu/config.rb +123 -81
  45. data/modules/mu/config/alarm.rb +2 -6
  46. data/modules/mu/config/bucket.rb +32 -3
  47. data/modules/mu/config/cache_cluster.rb +2 -2
  48. data/modules/mu/config/cdn.rb +100 -0
  49. data/modules/mu/config/collection.rb +1 -1
  50. data/modules/mu/config/container_cluster.rb +7 -2
  51. data/modules/mu/config/database.rb +84 -105
  52. data/modules/mu/config/database.yml +1 -2
  53. data/modules/mu/config/dnszone.rb +5 -4
  54. data/modules/mu/config/doc_helpers.rb +5 -6
  55. data/modules/mu/config/endpoint.rb +2 -1
  56. data/modules/mu/config/firewall_rule.rb +3 -19
  57. data/modules/mu/config/folder.rb +1 -1
  58. data/modules/mu/config/function.rb +17 -8
  59. data/modules/mu/config/group.rb +1 -1
  60. data/modules/mu/config/habitat.rb +1 -1
  61. data/modules/mu/config/job.rb +89 -0
  62. data/modules/mu/config/loadbalancer.rb +57 -11
  63. data/modules/mu/config/log.rb +1 -1
  64. data/modules/mu/config/msg_queue.rb +1 -1
  65. data/modules/mu/config/nosqldb.rb +1 -1
  66. data/modules/mu/config/notifier.rb +8 -19
  67. data/modules/mu/config/ref.rb +92 -14
  68. data/modules/mu/config/role.rb +1 -1
  69. data/modules/mu/config/schema_helpers.rb +38 -37
  70. data/modules/mu/config/search_domain.rb +1 -1
  71. data/modules/mu/config/server.rb +12 -13
  72. data/modules/mu/config/server_pool.rb +3 -7
  73. data/modules/mu/config/storage_pool.rb +1 -1
  74. data/modules/mu/config/tail.rb +11 -0
  75. data/modules/mu/config/user.rb +1 -1
  76. data/modules/mu/config/vpc.rb +27 -23
  77. data/modules/mu/config/vpc.yml +0 -1
  78. data/modules/mu/defaults/AWS.yaml +90 -90
  79. data/modules/mu/defaults/Azure.yaml +1 -0
  80. data/modules/mu/defaults/Google.yaml +1 -0
  81. data/modules/mu/deploy.rb +34 -20
  82. data/modules/mu/groomer.rb +16 -1
  83. data/modules/mu/groomers/ansible.rb +69 -4
  84. data/modules/mu/groomers/chef.rb +51 -4
  85. data/modules/mu/logger.rb +120 -144
  86. data/modules/mu/master.rb +97 -4
  87. data/modules/mu/mommacat.rb +160 -874
  88. data/modules/mu/mommacat/daemon.rb +23 -14
  89. data/modules/mu/mommacat/naming.rb +110 -3
  90. data/modules/mu/mommacat/search.rb +497 -0
  91. data/modules/mu/mommacat/storage.rb +252 -194
  92. data/modules/mu/{clouds → providers}/README.md +1 -1
  93. data/modules/mu/{clouds → providers}/aws.rb +258 -57
  94. data/modules/mu/{clouds → providers}/aws/alarm.rb +3 -3
  95. data/modules/mu/{clouds → providers}/aws/bucket.rb +275 -41
  96. data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +14 -50
  97. data/modules/mu/providers/aws/cdn.rb +782 -0
  98. data/modules/mu/{clouds → providers}/aws/collection.rb +5 -5
  99. data/modules/mu/{clouds → providers}/aws/container_cluster.rb +95 -84
  100. data/modules/mu/providers/aws/database.rb +1744 -0
  101. data/modules/mu/{clouds → providers}/aws/dnszone.rb +26 -12
  102. data/modules/mu/providers/aws/endpoint.rb +1072 -0
  103. data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +39 -32
  104. data/modules/mu/{clouds → providers}/aws/folder.rb +1 -1
  105. data/modules/mu/{clouds → providers}/aws/function.rb +289 -134
  106. data/modules/mu/{clouds → providers}/aws/group.rb +18 -20
  107. data/modules/mu/{clouds → providers}/aws/habitat.rb +3 -3
  108. data/modules/mu/providers/aws/job.rb +466 -0
  109. data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +77 -47
  110. data/modules/mu/{clouds → providers}/aws/log.rb +5 -5
  111. data/modules/mu/{clouds → providers}/aws/msg_queue.rb +14 -11
  112. data/modules/mu/{clouds → providers}/aws/nosqldb.rb +96 -5
  113. data/modules/mu/{clouds → providers}/aws/notifier.rb +135 -63
  114. data/modules/mu/{clouds → providers}/aws/role.rb +76 -48
  115. data/modules/mu/{clouds → providers}/aws/search_domain.rb +172 -41
  116. data/modules/mu/{clouds → providers}/aws/server.rb +66 -98
  117. data/modules/mu/{clouds → providers}/aws/server_pool.rb +42 -60
  118. data/modules/mu/{clouds → providers}/aws/storage_pool.rb +21 -38
  119. data/modules/mu/{clouds → providers}/aws/user.rb +12 -16
  120. data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
  121. data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +5 -4
  122. data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
  123. data/modules/mu/{clouds → providers}/aws/vpc.rb +143 -74
  124. data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
  125. data/modules/mu/{clouds → providers}/azure.rb +13 -0
  126. data/modules/mu/{clouds → providers}/azure/container_cluster.rb +1 -5
  127. data/modules/mu/{clouds → providers}/azure/firewall_rule.rb +8 -1
  128. data/modules/mu/{clouds → providers}/azure/habitat.rb +0 -0
  129. data/modules/mu/{clouds → providers}/azure/loadbalancer.rb +0 -0
  130. data/modules/mu/{clouds → providers}/azure/role.rb +0 -0
  131. data/modules/mu/{clouds → providers}/azure/server.rb +32 -24
  132. data/modules/mu/{clouds → providers}/azure/user.rb +1 -1
  133. data/modules/mu/{clouds → providers}/azure/userdata/README.md +0 -0
  134. data/modules/mu/{clouds → providers}/azure/userdata/linux.erb +0 -0
  135. data/modules/mu/{clouds → providers}/azure/userdata/windows.erb +0 -0
  136. data/modules/mu/{clouds → providers}/azure/vpc.rb +4 -6
  137. data/modules/mu/{clouds → providers}/cloudformation.rb +10 -0
  138. data/modules/mu/{clouds → providers}/cloudformation/alarm.rb +3 -3
  139. data/modules/mu/{clouds → providers}/cloudformation/cache_cluster.rb +3 -3
  140. data/modules/mu/{clouds → providers}/cloudformation/collection.rb +3 -3
  141. data/modules/mu/{clouds → providers}/cloudformation/database.rb +6 -17
  142. data/modules/mu/{clouds → providers}/cloudformation/dnszone.rb +3 -3
  143. data/modules/mu/{clouds → providers}/cloudformation/firewall_rule.rb +3 -3
  144. data/modules/mu/{clouds → providers}/cloudformation/loadbalancer.rb +3 -3
  145. data/modules/mu/{clouds → providers}/cloudformation/log.rb +3 -3
  146. data/modules/mu/{clouds → providers}/cloudformation/server.rb +7 -7
  147. data/modules/mu/{clouds → providers}/cloudformation/server_pool.rb +5 -5
  148. data/modules/mu/{clouds → providers}/cloudformation/vpc.rb +3 -3
  149. data/modules/mu/{clouds → providers}/docker.rb +0 -0
  150. data/modules/mu/{clouds → providers}/google.rb +29 -6
  151. data/modules/mu/{clouds → providers}/google/bucket.rb +4 -4
  152. data/modules/mu/{clouds → providers}/google/container_cluster.rb +38 -20
  153. data/modules/mu/{clouds → providers}/google/database.rb +5 -12
  154. data/modules/mu/{clouds → providers}/google/firewall_rule.rb +5 -5
  155. data/modules/mu/{clouds → providers}/google/folder.rb +5 -9
  156. data/modules/mu/{clouds → providers}/google/function.rb +6 -6
  157. data/modules/mu/{clouds → providers}/google/group.rb +9 -17
  158. data/modules/mu/{clouds → providers}/google/habitat.rb +4 -8
  159. data/modules/mu/{clouds → providers}/google/loadbalancer.rb +5 -5
  160. data/modules/mu/{clouds → providers}/google/role.rb +50 -31
  161. data/modules/mu/{clouds → providers}/google/server.rb +41 -24
  162. data/modules/mu/{clouds → providers}/google/server_pool.rb +14 -14
  163. data/modules/mu/{clouds → providers}/google/user.rb +34 -24
  164. data/modules/mu/{clouds → providers}/google/userdata/README.md +0 -0
  165. data/modules/mu/{clouds → providers}/google/userdata/linux.erb +0 -0
  166. data/modules/mu/{clouds → providers}/google/userdata/windows.erb +0 -0
  167. data/modules/mu/{clouds → providers}/google/vpc.rb +45 -14
  168. data/modules/tests/aws-jobs-functions.yaml +46 -0
  169. data/modules/tests/centos6.yaml +15 -0
  170. data/modules/tests/centos7.yaml +15 -0
  171. data/modules/tests/centos8.yaml +12 -0
  172. data/modules/tests/ecs.yaml +2 -2
  173. data/modules/tests/eks.yaml +1 -1
  174. data/modules/tests/functions/node-function/lambda_function.js +10 -0
  175. data/modules/tests/functions/python-function/lambda_function.py +12 -0
  176. data/modules/tests/microservice_app.yaml +288 -0
  177. data/modules/tests/rds.yaml +108 -0
  178. data/modules/tests/regrooms/rds.yaml +123 -0
  179. data/modules/tests/server-with-scrub-muisms.yaml +1 -1
  180. data/modules/tests/super_complex_bok.yml +2 -2
  181. data/modules/tests/super_simple_bok.yml +3 -5
  182. data/spec/mu/clouds/azure_spec.rb +2 -2
  183. metadata +122 -92
  184. data/modules/mu/clouds/aws/database.rb +0 -1974
  185. data/modules/mu/clouds/aws/endpoint.rb +0 -596
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2a3a37b9669c04e28e4b5a0d2f80a2de02478dabac733c90e9d36dae452528c
4
- data.tar.gz: 654354392527c27ac2825bce89b992f209577cbf97dbdce29ceeb23565cf733d
3
+ metadata.gz: 831bdab20f2750e0080d2282d6bbb14710339b442bd484ae539b496f9e9cbe07
4
+ data.tar.gz: 1e8369e3e7937fa4bda0002a13cada2d7d99eb5c9bede0bd11b5009d5ac62add
5
5
  SHA512:
6
- metadata.gz: d09fbaa85a8bfa880b35aad227367a4b156635d847ca9f697a7e6cbc93600b0b59fd495dd180e2d6955f160dab83f81335e7d47a6c2027c6598fd8b82da97c2a
7
- data.tar.gz: b49216fcc464945f3f27b0927c59b3e41b906ddaf09f7b87433a37eec54330462cf246058fa9959d3d1ec90ee1570fc3921bc7e0da0a1552c1d4664832e4d42e
6
+ metadata.gz: 7677217cea3460bccc8bfcfc6cd39400e6efc659ceaf35c80742885b541988ad42776385dc232d72848acd34d9dcbed5d44abe6ea6e5af688b3d6ec86ac5a6d6
7
+ data.tar.gz: 2e26064eb275a1f68f73766558bd39513c50a4218aeb8968779f6592d3b1210c4b84ee2808455d81bc3eac3bf8dad3027e97f451a99c9dd5bd87d05c77fb8880
data/Dockerfile CHANGED
@@ -8,7 +8,7 @@ RUN df -h
8
8
 
9
9
  RUN apt-get update
10
10
 
11
- RUN apt-get install -y ruby2.5-dev dnsutils ansible build-essential
11
+ RUN apt-get install -y ruby2.5-dev dnsutils ansible build-essential python-pip curl openssh-client
12
12
 
13
13
  RUN apt-get upgrade -y
14
14
 
@@ -24,10 +24,14 @@ RUN ls -la
24
24
 
25
25
  #RUN rm --verbose -f cloud-mu-*.gem
26
26
 
27
+ RUN pip install pywinrm
28
+
27
29
  RUN apt-get remove -y build-essential ruby2.5-dev
28
30
 
29
31
  RUN apt-get autoremove -y
30
32
 
33
+ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl && mv kubectl /usr/bin && chmod +x /usr/bin/kubectl
34
+
31
35
  EXPOSE 2260
32
36
 
33
37
  CMD /usr/sbin/init
@@ -0,0 +1,9 @@
1
+ {
2
+ "setComputerName": false,
3
+ "setMonitorAlwaysOn": true,
4
+ "setWallpaper": true,
5
+ "addDnsSuffixList": true,
6
+ "extendBootVolumeSize": true,
7
+ "handleUserData": true,
8
+ "adminPasswordType": "Random"
9
+ }
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Ec2ConfigurationSettings>
3
+ <Plugins>
4
+ <Plugin>
5
+ <Name>Ec2SetPassword</Name>
6
+ <State>Enabled</State>
7
+ </Plugin>
8
+ <Plugin>
9
+ <Name>Ec2SetComputerName</Name>
10
+ <State>Disabled</State>
11
+ </Plugin>
12
+ <Plugin>
13
+ <Name>Ec2InitializeDrives</Name>
14
+ <State>Enabled</State>
15
+ </Plugin>
16
+ <Plugin>
17
+ <Name>Ec2EventLog</Name>
18
+ <State>Disabled</State>
19
+ </Plugin>
20
+ <Plugin>
21
+ <Name>Ec2ConfigureRDP</Name>
22
+ <State>Disabled</State>
23
+ </Plugin>
24
+ <Plugin>
25
+ <Name>Ec2OutputRDPCert</Name>
26
+ <State>Enabled</State>
27
+ </Plugin>
28
+ <Plugin>
29
+ <Name>Ec2SetDriveLetter</Name>
30
+ <State>Enabled</State>
31
+ </Plugin>
32
+ <Plugin>
33
+ <Name>Ec2WindowsActivate</Name>
34
+ <State>Enabled</State>
35
+ </Plugin>
36
+ <Plugin>
37
+ <Name>Ec2DynamicBootVolumeSize</Name>
38
+ <State>Disabled</State>
39
+ </Plugin>
40
+ <Plugin>
41
+ <Name>Ec2SetHibernation</Name>
42
+ <State>Enabled</State>
43
+ </Plugin>
44
+ <Plugin>
45
+ <Name>Ec2SetMonitorAlwaysOn</Name>
46
+ <State>Disabled</State>
47
+ </Plugin>
48
+ <Plugin>
49
+ <Name>Ec2ElasticGpuSetup</Name>
50
+ <State>Enabled</State>
51
+ </Plugin>
52
+ <Plugin>
53
+ <Name>Ec2FeatureLogging</Name>
54
+ <State>Enabled</State>
55
+ </Plugin>
56
+ <Plugin>
57
+ <Name>Ec2SetENAConfig</Name>
58
+ <State>Enabled</State>
59
+ </Plugin>
60
+ <Plugin>
61
+ <Name>Ec2HandleUserData</Name>
62
+ <State>Enabled</State>
63
+ </Plugin>
64
+ <Plugin>
65
+ <Name>AWS.EC2.Windows.CloudWatch.PlugIn</Name>
66
+ <State>Disabled</State>
67
+ </Plugin>
68
+ </Plugins>
69
+ <GlobalSettings>
70
+ <ManageShutdown>true</ManageShutdown>
71
+ <SetDnsSuffixList>true</SetDnsSuffixList>
72
+ <WaitForMetaDataAvailable>true</WaitForMetaDataAvailable>
73
+ <ShouldAddRoutes>true</ShouldAddRoutes>
74
+ <RemoveCredentialsfromSysprepOnStartup>true</RemoveCredentialsfromSysprepOnStartup>
75
+ </GlobalSettings>
76
+ </Ec2ConfigurationSettings>
@@ -18,3 +18,19 @@
18
18
  win_chocolatey:
19
19
  name: openssh
20
20
  state: present
21
+
22
+ - name: "Tell EC2Config to set a random password on next boot (Windows 2012)"
23
+ when: ((ansible_facts['distribution_major_version'] | int) < 10 and mu_build_image is defined and mu_build_image == True)
24
+ win_copy:
25
+ src: config.xml
26
+ dest: "c:/Program Files/Amazon/EC2ConfigService/Settings/config.xml"
27
+
28
+ - name: "Tell EC2Launch to set a random password (Windows 2016+)"
29
+ when: ((ansible_facts['distribution_major_version'] | int) >= 10 and mu_build_image is defined and mu_build_image == True)
30
+ win_copy:
31
+ src: LaunchConfig.json
32
+ dest: "c:/ProgramData/Amazon/EC2-Windows/Launch/Config/LaunchConfig.json"
33
+
34
+ - name: "Tell EC2Launch to run on next boot (Windows 2016+)"
35
+ when: ((ansible_facts['distribution_major_version'] | int) >= 10 and mu_build_image is defined and mu_build_image == True)
36
+ win_shell: C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
@@ -21,12 +21,6 @@ require 'bundler/setup'
21
21
  require 'optimist'
22
22
  require 'mu'
23
23
 
24
- available_clouds = MU::Cloud.supportedClouds
25
- available_clouds.reject! { |cloud|
26
- cloudclass = Object.const_get("MU").const_get("Cloud").const_get(cloud)
27
- cloudclass.listCredentials.nil? or cloudclass.listCredentials.size == 0
28
- }
29
-
30
24
  available_types = MU::Cloud.resource_types.keys.map { |t| t.to_s }
31
25
  grouping_options = {
32
26
  "logical" => "Group resources in logical layers (folders and habitats together, users/roles/groups together, network resources together, etc)",
@@ -39,15 +33,19 @@ $opt = Optimist::options do
39
33
  EOS
40
34
  opt :appname, "The overarching name of the application stack we will generate", :required => false, :default => "mu", :type => :string
41
35
  opt :types, "The resource types to scan and import. Valid types: #{available_types.join(", ")}", :required => false, :type => :strings, :default => available_types
42
- opt :clouds, "The cloud providers to scan and import.", :required => false, :type => :strings, :default => available_clouds
36
+ opt :clouds, "The cloud providers to scan and import.", :required => false, :type => :strings, :default => MU::Cloud.availableClouds
43
37
  opt :parent, "Where applicable, resources which reside in the root folder or organization are configured with the specified parent in our target BoK", :required => false, :type => :string
44
38
  opt :billing, "Force-set this billing entity on created resources, instead of copying from the live resources", :required => false, :type => :string
45
39
  opt :sources, "One or more sets of credentials to use when importing resources. By default we will search and import from all sets of available credentials for each cloud provider specified with --clouds", :required => false, :type => :strings
46
40
  opt :credentials, "Override the 'credentials' value in our generated Baskets of Kittens to target a single, specific account. Our default behavior is to set each resource to deploy into the account from which it was sourced.", :required => false, :type => :string
47
41
  opt :savedeploys, "Generate actual deployment metadata in #{MU.dataDir}/deployments, as though the resources we found were created with mu-deploy. If we are generating more than one configuration, and a resource needs to reference another resource (e.g. to declare a VPC in which to reside), this will allow us to reference them as virtual resource, rather than by raw cloud identifier.", :required => false, :type => :boolean, :default => false
48
42
  opt :diff, "List the differences between what we find and an existing, saved deploy from a previous run, if one exists.", :required => false, :type => :boolean
43
+ opt :merge_changes, "When using --diff, merge detected changes into the baseline deploy after reporting on them.", :required => false, :type => :boolean, :default => false
49
44
  opt :grouping, "Methods for grouping found resources into separate Baskets.\n\n"+MU::Adoption::GROUPMODES.keys.map { |g| "* "+g.to_s+": "+MU::Adoption::GROUPMODES[g] }.join("\n")+"\n\n", :required => false, :type => :string, :default => "logical"
50
45
  opt :habitats, "Limit scope of searches to the named accounts/projects/subscriptions, instead of search all habitats visible to our credentials.", :required => false, :type => :strings
46
+ opt :regions, "Restrict to operating on a subset of available regions, instead of all that we know about.", :require => false, :type => :strings
47
+ opt :scrub, "Whether to set scrub_mu_isms in the BoKs we generate", :default => $MU_CFG.has_key?('adopt_scrub_mu_isms') ? $MU_CFG['adopt_scrub_mu_isms'] : false
48
+ opt :pattern, "Only adopt resources whose resource name would match this pattern. Must be a valid regular expression. Alphabetical characters will be treated case-insensitively.", :required => false, :type => :string
51
49
  end
52
50
 
53
51
  ok = true
@@ -63,6 +61,16 @@ if $opt[:diff]
63
61
  $opt[:savedeploys] = false
64
62
  end
65
63
 
64
+ pattern = nil
65
+ if $opt[:pattern]
66
+ begin
67
+ pattern = Regexp.new($opt[:pattern], true)
68
+ rescue RegexpError => e
69
+ MU.log "Invalid --pattern option: #{e.message}", MU::ERR
70
+ exit 1
71
+ end
72
+ end
73
+
66
74
  types = []
67
75
  $opt[:types].each { |t|
68
76
  t_name = t.gsub(/-/, "_")
@@ -101,8 +109,7 @@ if !ok
101
109
  exit 1
102
110
  end
103
111
 
104
-
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])
112
+ 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], scrub_mu_isms: $opt[:scrub], regions: $opt[:regions], merge: $opt[:merge_changes], pattern: pattern)
106
113
  found = adoption.scrapeClouds
107
114
  if found.nil? or found.empty?
108
115
  MU.log "No resources found to adopt", MU::WARN, details: {"clouds" => clouds, "types" => types }
@@ -116,10 +123,7 @@ boks.each_pair { |appname, bok|
116
123
  File.open("#{appname}.yaml", "w") { |f|
117
124
  f.write JSON.parse(JSON.generate(bok)).to_yaml
118
125
  }
119
- conf_engine = MU::Config.new("#{appname}.yaml")
120
- stack_conf = conf_engine.config
121
126
  # puts stack_conf.to_yaml
122
- MU.log "#{appname}.yaml validated successfully", MU::NOTICE
123
127
  MU::Cloud.resource_types.each_pair { |type, cfg|
124
128
  if bok[cfg[:cfg_plural]]
125
129
  MU.log "#{bok[cfg[:cfg_plural]].size.to_s} #{cfg[:cfg_plural]}", MU::NOTICE
@@ -0,0 +1,57 @@
1
+ #!/usr/local/ruby-current/bin/ruby
2
+ # Copyright:: Copyright (c) 2014 eGlobalTech, Inc., all rights reserved
3
+ #
4
+ # Licensed under the BSD-3 license (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License in the root of the project or at
7
+ #
8
+ # http://egt-labs.com/mu/LICENSE.html
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require 'rubygems'
17
+ require 'bundler/setup'
18
+ require 'json'
19
+ require 'erb'
20
+ require 'optimist'
21
+ require 'json-schema'
22
+ require File.realpath(File.expand_path(File.dirname(__FILE__)+"/mu-load-config.rb"))
23
+ require 'mu'
24
+
25
+ (0..100000).to_a.each { |n|
26
+ retries = 0
27
+ seed = nil
28
+ # begin
29
+ # raise MuError, "Failed to allocate an unused MU-ID after #{retries} tries!" if retries > 70
30
+ # seedsize = 1 + (retries/10).abs
31
+ # seed = (0...seedsize+1).map { ('a'..'z').to_a[rand(26)] }.join
32
+ # end while seed == "mu" or seed[0] == seed[1]
33
+ seed = "nn"
34
+ handle = MU::MommaCat.generateHandle(seed)
35
+ puts handle
36
+ }
37
+ exit
38
+
39
+ #pp MU::Cloud::Azure.listRegions
40
+ #pp MU::Cloud::Azure::Habitat.testcalls
41
+ #pp MU::Cloud::Azure::VPC.find(cloud_id: MU::Cloud::Azure::Id.new(resource_group: "mu", name: "mu-vnet"))
42
+ #pp MU::Cloud::Azure.authorization.role_assignments.list_for_resource_group("AKS-DEV-2019062015-KA-EASTUS")
43
+ #pp MU::Cloud::Azure::Role.find(role_name: "Azure Kubernetes Service Cluster Admin Role")
44
+ #puts MU::Cloud::Azure.default_subscription
45
+ #pp MU::Cloud::Azure.fetchPublicIP("MYVPC-DEV-2019061911-XI-EASTUS", "ip-addr-thingy")
46
+ #pp MU::Cloud::Azure.ensureProvider("egtazure", "Microsoft.ContainerService", force: true)
47
+ pp MU::Cloud::Azure::Server.find(cloud_id: "mu")
48
+ exit
49
+ pp MU::Cloud::Azure::Server.fetchImage("OpenLogic/CentOS/6")
50
+ pp MU::Cloud::Azure::Server.fetchImage("OpenLogic/CentOS/7")
51
+ pp MU::Cloud::Azure::Server.fetchImage("RedHat/RHEL/8")
52
+ pp MU::Cloud::Azure::Server.fetchImage("RedHat/RHEL/7")
53
+ pp MU::Cloud::Azure::Server.fetchImage("RedHat/RHEL/6")
54
+ pp MU::Cloud::Azure::Server.fetchImage("Debian/debian-10/10")
55
+ pp MU::Cloud::Azure::Server.fetchImage("MicrosoftWindowsServer/WindowsServer/2012-R2-Datacenter")
56
+ pp MU::Cloud::Azure::Server.fetchImage("MicrosoftWindowsServer/WindowsServer/2016-Datacenter")
57
+ pp MU::Cloud::Azure::Server.fetchImage("MicrosoftWindowsServer/WindowsServer/2019-Datacenter")
@@ -24,10 +24,8 @@ require 'mu'
24
24
  Dir.chdir(MU.installDir)
25
25
 
26
26
  credentials = []
27
- MU::Cloud.supportedClouds.each { |cloud|
28
- cloudclass = Object.const_get("MU").const_get("Cloud").const_get(cloud)
29
- next if cloudclass.listCredentials.nil? or cloudclass.listCredentials.size == 0
30
- credentials.concat(cloudclass.listCredentials)
27
+ MU::Cloud.availableClouds.each { |cloud|
28
+ credentials.concat(MU::Cloud.cloudClass(cloud).listCredentials)
31
29
  }
32
30
  credentials.uniq!
33
31
 
@@ -113,6 +113,44 @@ $CONFIGURABLES = {
113
113
  "desc" => "Disable the Momma Cat grooming daemon. Nodes which require asynchronous Ansible/Chef bootstraps will not function. This option is only honored in gem-based installations.",
114
114
  "boolean" => true
115
115
  },
116
+ "adopt_change_notify" => {
117
+ "title" => "Adoption Change Notifications",
118
+ "subtree" => {
119
+ "slack" => {
120
+ "title" => "Send to Slack",
121
+ "desc" => "Report modifications to adopted resources, detected by mu-adopt --diff, to the Slack webhook and channel configured under Slack Configuration.",
122
+ "boolean" => true
123
+ },
124
+ "slack_snippet_threshold" => {
125
+ "title" => "Attachment Threshold",
126
+ "desc" => "If a list of details about a modified resources is longer than this number of lines (in JSON), it will be sent as an \"attachment,\" which in Slack means a blockquote that displays a few lines with a \"Show more\" button. The internal default is 5 lines."
127
+ },
128
+ # "email" => {
129
+ # "title" => "Send Email",
130
+ # "desc" => "",
131
+ # "boolean" => true
132
+ # }
133
+ }
134
+ },
135
+ "adopt_scrub_mu_isms" => {
136
+ "title" => "Scrub Mu-isms from Baskets of Kittens",
137
+ "default" => false,
138
+ "desc" => "Ordinarily, Mu will automatically name, tag and generate auxiliary resources in a standard Mu-ish fashion that allows for deployment of multiple clones of a given stack. Toggling this flag will change the default behavior of mu-adopt, when it creates stack descriptors from found resources, to enable or disable this behavior (see also mu-adopt's --scrub option).",
139
+ "boolean" => true
140
+ },
141
+ "slack" => {
142
+ "title" => "Slack Configuration",
143
+ "subtree" => {
144
+ "webhook" => {
145
+ "title" => "Webhook",
146
+ "desc" => "The hooks.slack.com URL for the webook to which we'll send deploy notifications"
147
+ },
148
+ "channel" => {
149
+ "title" => "Channel",
150
+ "desc" => "The channel name (without leading #) to which alerts should be sent."
151
+ }
152
+ }
153
+ },
116
154
  "mommacat_port" => {
117
155
  "title" => "Momma Cat Listen Port",
118
156
  "pattern" => /^[0-9]+$/i,
@@ -241,11 +279,25 @@ $CONFIGURABLES = {
241
279
  "required" => false,
242
280
  "desc" => "For Google Cloud projects which are attached to a GSuite domain. GCP service accounts cannot view or manage GSuite resources (groups, users, etc) directly, but must instead masquerade as a GSuite user which has delegated authority to the service account. See also: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority"
243
281
  },
282
+ "org" => {
283
+ "title" => "Default Org/Domain",
284
+ "desc" => "For credential sets which have access to multiple GSuite or Cloud Identity orgs, you must specify a default organization (e.g. my.domain.com)."
285
+ },
244
286
  "customer_id" => {
245
287
  "title" => "GSuite Customer ID",
246
288
  "required" => false,
247
289
  "desc" => "For Google Cloud projects which are attached to a GSuite domain. Some API calls (groups, users, etc) require this identifier. From admin.google.com, choose Security, the Single Sign On, and look for the Entity ID field. The value after idpid= in the URL there should be the customer ID."
248
290
  },
291
+ "ignore_habitats" => {
292
+ "title" => "Ignore These Projects",
293
+ "desc" => "Optional list of projects to ignore, for credentials which have visibility into multiple projects",
294
+ "array" => true
295
+ },
296
+ "restrict_to_habitats" => {
297
+ "title" => "Operate On Only These Projects",
298
+ "desc" => "Optional list of projects to which we'll restrict all of our activities.",
299
+ "array" => true
300
+ },
249
301
  "default" => {
250
302
  "title" => "Is Default Account",
251
303
  "default" => false,
@@ -105,7 +105,7 @@ if $opts[:dryrun]
105
105
  Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :never) {
106
106
  begin
107
107
  Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :immediate) {
108
- MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::WARN, verbosity: MU::Logger::NORMAL
108
+ MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::NOTICE, verbosity: MU::Logger::NORMAL
109
109
  Thread.current.exit
110
110
  }
111
111
  ensure
@@ -124,7 +124,7 @@ if $opts[:dryrun]
124
124
  )
125
125
  cost_dummy_deploy.run
126
126
  rescue MU::Cloud::MuCloudResourceNotImplemented, MU::Cloud::MuCloudFlagNotImplemented
127
- MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::WARN, verbosity: MU::Logger::NORMAL
127
+ MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::NOTICE, verbosity: MU::Logger::NORMAL
128
128
  end
129
129
  end
130
130
  exit
@@ -135,7 +135,7 @@ if $opts[:update]
135
135
  # TODO consider whether this is useful/valid
136
136
  # old_conf = JSON.parse(File.read(deploy.deploy_dir+"/basket_of_kittens.json"))
137
137
  # stack_conf = old_conf.merge(stack_conf)
138
- deploy.updateBasketofKittens(stack_conf)
138
+ deploy.updateBasketofKittens(stack_conf, skip_validation: true)
139
139
  deployer = MU::Deploy.new(
140
140
  deploy.environment,
141
141
  verbosity: verbosity,
@@ -0,0 +1,25 @@
1
+ #!/usr/local/ruby-current/bin/ruby
2
+ # Copyright:: Copyright (c) 2014 eGlobalTech, Inc., all rights reserved
3
+ #
4
+ # Licensed under the BSD-3 license (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License in the root of the project or at
7
+ #
8
+ # http://egt-labs.com/mu/LICENSE.html
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require 'rubygems'
17
+ require 'bundler/setup'
18
+ require 'json'
19
+ require 'erb'
20
+ require 'optimist'
21
+ require 'json-schema'
22
+ require File.realpath(File.expand_path(File.dirname(__FILE__)+"/mu-load-config.rb"))
23
+ require 'mu'
24
+
25
+ MU::MommaCat.findStray("AWS", "firewall_rule", region: MU.myRegion, dummy_ok: true, debug: true)
@@ -79,8 +79,7 @@ EOF
79
79
  impl_counts[type] ||= 0
80
80
  [a, b].each { |cloud|
81
81
  begin
82
- myclass = Object.const_get("MU").const_get("Cloud").const_get(cloud).const_get(type)
83
- case myclass.quality
82
+ case MU::Cloud.resourceClass(cloud, type).quality
84
83
  when MU::Cloud::RELEASE
85
84
  cloud_is_useful[cloud] = true
86
85
  counts[cloud] += 4
@@ -114,8 +113,7 @@ EOF
114
113
  cloudlist.each { |cloud|
115
114
  readme += "<td><center>"
116
115
  begin
117
- myclass = Object.const_get("MU").const_get("Cloud").const_get(cloud).const_get(type)
118
- case myclass.quality
116
+ case MU::Cloud.resourceClass(cloud, type).quality
119
117
  when MU::Cloud::RELEASE
120
118
  readme += "<img src='release.png' style='#{icon_style}' title='Release Quality' alt='[Release Quality]'>"
121
119
  when MU::Cloud::BETA
@@ -134,7 +134,7 @@ def loadMuConfig(default_cfg_overrides = nil)
134
134
  }
135
135
  end
136
136
 
137
- global_cfg = { "config_files" => [] }
137
+ global_cfg = { "config_files" => [], "overridden_keys" => [] }
138
138
  if File.exist?(cfgPath)
139
139
  global_cfg = YAML.load(File.read(cfgPath))
140
140
  global_cfg["config_files"] = [cfgPath]
@@ -147,6 +147,7 @@ def loadMuConfig(default_cfg_overrides = nil)
147
147
  if localfile
148
148
  global_cfg.merge!(localfile)
149
149
  global_cfg["config_files"] << "#{home}/.mu.yaml"
150
+ global_cfg["overridden_keys"] = localfile.keys
150
151
  end
151
152
  end
152
153
  if !global_cfg.has_key?("installdir")