bosh_cli 0.16

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 (113) hide show
  1. data/README +4 -0
  2. data/Rakefile +55 -0
  3. data/bin/bosh +17 -0
  4. data/lib/cli.rb +76 -0
  5. data/lib/cli/cache.rb +44 -0
  6. data/lib/cli/changeset_helper.rb +142 -0
  7. data/lib/cli/command_definition.rb +52 -0
  8. data/lib/cli/commands/base.rb +245 -0
  9. data/lib/cli/commands/biff.rb +300 -0
  10. data/lib/cli/commands/blob.rb +125 -0
  11. data/lib/cli/commands/cloudcheck.rb +169 -0
  12. data/lib/cli/commands/deployment.rb +147 -0
  13. data/lib/cli/commands/job.rb +42 -0
  14. data/lib/cli/commands/job_management.rb +117 -0
  15. data/lib/cli/commands/log_management.rb +81 -0
  16. data/lib/cli/commands/maintenance.rb +131 -0
  17. data/lib/cli/commands/misc.rb +240 -0
  18. data/lib/cli/commands/package.rb +112 -0
  19. data/lib/cli/commands/property_management.rb +125 -0
  20. data/lib/cli/commands/release.rb +469 -0
  21. data/lib/cli/commands/ssh.rb +271 -0
  22. data/lib/cli/commands/stemcell.rb +184 -0
  23. data/lib/cli/commands/task.rb +213 -0
  24. data/lib/cli/commands/user.rb +28 -0
  25. data/lib/cli/commands/vms.rb +53 -0
  26. data/lib/cli/config.rb +154 -0
  27. data/lib/cli/core_ext.rb +145 -0
  28. data/lib/cli/dependency_helper.rb +62 -0
  29. data/lib/cli/deployment_helper.rb +263 -0
  30. data/lib/cli/deployment_manifest_compiler.rb +28 -0
  31. data/lib/cli/director.rb +633 -0
  32. data/lib/cli/director_task.rb +64 -0
  33. data/lib/cli/errors.rb +48 -0
  34. data/lib/cli/event_log_renderer.rb +351 -0
  35. data/lib/cli/job_builder.rb +226 -0
  36. data/lib/cli/package_builder.rb +254 -0
  37. data/lib/cli/packaging_helper.rb +248 -0
  38. data/lib/cli/release.rb +176 -0
  39. data/lib/cli/release_builder.rb +215 -0
  40. data/lib/cli/release_compiler.rb +178 -0
  41. data/lib/cli/release_tarball.rb +272 -0
  42. data/lib/cli/runner.rb +771 -0
  43. data/lib/cli/stemcell.rb +83 -0
  44. data/lib/cli/task_log_renderer.rb +40 -0
  45. data/lib/cli/templates/help_message.erb +75 -0
  46. data/lib/cli/validation.rb +42 -0
  47. data/lib/cli/version.rb +7 -0
  48. data/lib/cli/version_calc.rb +48 -0
  49. data/lib/cli/versions_index.rb +126 -0
  50. data/lib/cli/yaml_helper.rb +62 -0
  51. data/spec/assets/biff/bad_gateway_config.yml +28 -0
  52. data/spec/assets/biff/good_simple_config.yml +63 -0
  53. data/spec/assets/biff/good_simple_golden_config.yml +63 -0
  54. data/spec/assets/biff/good_simple_template.erb +69 -0
  55. data/spec/assets/biff/multiple_subnets_config.yml +40 -0
  56. data/spec/assets/biff/network_only_template.erb +34 -0
  57. data/spec/assets/biff/no_cc_config.yml +27 -0
  58. data/spec/assets/biff/no_range_config.yml +27 -0
  59. data/spec/assets/biff/no_subnet_config.yml +16 -0
  60. data/spec/assets/biff/ok_network_config.yml +30 -0
  61. data/spec/assets/biff/properties_template.erb +6 -0
  62. data/spec/assets/deployment.MF +0 -0
  63. data/spec/assets/plugins/bosh/cli/commands/echo.rb +43 -0
  64. data/spec/assets/plugins/bosh/cli/commands/ruby.rb +24 -0
  65. data/spec/assets/release/jobs/cacher.tgz +0 -0
  66. data/spec/assets/release/jobs/cacher/config/file1.conf +0 -0
  67. data/spec/assets/release/jobs/cacher/config/file2.conf +0 -0
  68. data/spec/assets/release/jobs/cacher/job.MF +6 -0
  69. data/spec/assets/release/jobs/cacher/monit +1 -0
  70. data/spec/assets/release/jobs/cleaner.tgz +0 -0
  71. data/spec/assets/release/jobs/cleaner/job.MF +4 -0
  72. data/spec/assets/release/jobs/cleaner/monit +1 -0
  73. data/spec/assets/release/jobs/sweeper.tgz +0 -0
  74. data/spec/assets/release/jobs/sweeper/config/test.conf +1 -0
  75. data/spec/assets/release/jobs/sweeper/job.MF +5 -0
  76. data/spec/assets/release/jobs/sweeper/monit +1 -0
  77. data/spec/assets/release/packages/mutator.tar.gz +0 -0
  78. data/spec/assets/release/packages/stuff.tgz +0 -0
  79. data/spec/assets/release/release.MF +17 -0
  80. data/spec/assets/release_invalid_checksum.tgz +0 -0
  81. data/spec/assets/release_invalid_jobs.tgz +0 -0
  82. data/spec/assets/release_no_name.tgz +0 -0
  83. data/spec/assets/release_no_version.tgz +0 -0
  84. data/spec/assets/stemcell/image +1 -0
  85. data/spec/assets/stemcell/stemcell.MF +6 -0
  86. data/spec/assets/stemcell_invalid_mf.tgz +0 -0
  87. data/spec/assets/stemcell_no_image.tgz +0 -0
  88. data/spec/assets/valid_release.tgz +0 -0
  89. data/spec/assets/valid_stemcell.tgz +0 -0
  90. data/spec/spec_helper.rb +25 -0
  91. data/spec/unit/base_command_spec.rb +66 -0
  92. data/spec/unit/biff_spec.rb +135 -0
  93. data/spec/unit/cache_spec.rb +36 -0
  94. data/spec/unit/cli_commands_spec.rb +481 -0
  95. data/spec/unit/config_spec.rb +139 -0
  96. data/spec/unit/core_ext_spec.rb +77 -0
  97. data/spec/unit/dependency_helper_spec.rb +52 -0
  98. data/spec/unit/deployment_manifest_compiler_spec.rb +63 -0
  99. data/spec/unit/director_spec.rb +511 -0
  100. data/spec/unit/director_task_spec.rb +48 -0
  101. data/spec/unit/event_log_renderer_spec.rb +171 -0
  102. data/spec/unit/hash_changeset_spec.rb +73 -0
  103. data/spec/unit/job_builder_spec.rb +454 -0
  104. data/spec/unit/package_builder_spec.rb +567 -0
  105. data/spec/unit/release_builder_spec.rb +65 -0
  106. data/spec/unit/release_spec.rb +66 -0
  107. data/spec/unit/release_tarball_spec.rb +33 -0
  108. data/spec/unit/runner_spec.rb +140 -0
  109. data/spec/unit/ssh_spec.rb +78 -0
  110. data/spec/unit/stemcell_spec.rb +17 -0
  111. data/spec/unit/version_calc_spec.rb +27 -0
  112. data/spec/unit/versions_index_spec.rb +132 -0
  113. metadata +338 -0
@@ -0,0 +1,28 @@
1
+ ---
2
+ networks:
3
+
4
+ - name: default
5
+ subnets:
6
+ - reserved:
7
+ - 172.31.116.2 - 172.31.116.9
8
+ - 172.31.119.245 - 172.31.119.254
9
+ static:
10
+ - 172.31.116.10 - 172.31.116.140
11
+ range: 172.31.116.0/22
12
+ # Should only be .1
13
+ gateway: 172.31.116.55
14
+ dns:
15
+ - 172.30.22.153
16
+ - 172.30.22.154
17
+ cloud_properties:
18
+ name: VLAN2116
19
+ - name: lb
20
+ subnets:
21
+ - static:
22
+ - 172.28.3.145-172.28.3.146
23
+ range: 172.28.3.144/28
24
+ dns:
25
+ - 172.30.22.153
26
+ - 172.30.22.154
27
+ cloud_properties:
28
+ name: VLAN3057
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: ben-cloud
3
+ director_uuid: a8f335a4-30f0-4a92-ab88-5c3feb55577a
4
+
5
+ networks:
6
+
7
+ - name: default
8
+ subnets:
9
+ - reserved:
10
+ - 172.31.4.2 - 172.31.4.9
11
+ - 172.31.7.245 - 172.31.7.254
12
+ static:
13
+ - 172.31.4.10 - 172.31.4.140
14
+ range: 172.31.4.0/22
15
+ gateway: 172.31.4.1
16
+ dns:
17
+ - 172.30.22.153
18
+ - 172.30.22.154
19
+ cloud_properties:
20
+ name: VLAN2004
21
+ - name: lb
22
+ subnets:
23
+ - static:
24
+ - 172.28.6.241 - 172.28.6.242
25
+ range: 172.28.6.240/28
26
+ dns:
27
+ - 172.30.22.153
28
+ - 172.30.22.154
29
+ cloud_properties:
30
+ name: VLAN3121
31
+
32
+ jobs:
33
+
34
+ - name: debian_nfs_server
35
+ template: debian_nfs_server
36
+ instances: 1
37
+ resource_pool: infrastructure
38
+ persistent_disk: 8192
39
+ networks:
40
+ - name: default
41
+ static_ips:
42
+ - 172.31.4.10
43
+
44
+ - name: syslog_aggregator
45
+ template: syslog_aggregator
46
+ instances: 1
47
+ resource_pool: infrastructure
48
+ persistent_disk: 600
49
+ networks:
50
+ - name: default
51
+ static_ips:
52
+ - 172.31.4.13
53
+
54
+ properties:
55
+ domain: appcloud23.dev.mozycloud.com
56
+
57
+ nfs_server:
58
+ address: 172.31.4.10
59
+ network: 172.31.4.0/22
60
+
61
+ syslog_aggregator:
62
+ address: 172.31.4.13
63
+ port: 54321
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: ben-cloud
3
+ director_uuid: a8f335a4-30f0-4a92-ab88-5c3feb55577a
4
+
5
+ networks:
6
+
7
+ - name: default
8
+ subnets:
9
+ - reserved:
10
+ - 172.31.4.2 - 172.31.4.9
11
+ - 172.31.7.245 - 172.31.7.254
12
+ static:
13
+ - 172.31.4.10 - 172.31.4.140
14
+ range: 172.31.4.0/22
15
+ gateway: 172.31.4.1
16
+ dns:
17
+ - 172.30.22.153
18
+ - 172.30.22.154
19
+ cloud_properties:
20
+ name: VLAN2004
21
+ - name: lb
22
+ subnets:
23
+ - static:
24
+ - 172.28.6.241 - 172.28.6.242
25
+ range: 172.28.6.240/28
26
+ dns:
27
+ - 172.30.22.153
28
+ - 172.30.22.154
29
+ cloud_properties:
30
+ name: VLAN3121
31
+
32
+ jobs:
33
+
34
+ - name: debian_nfs_server
35
+ template: debian_nfs_server
36
+ instances: 1
37
+ resource_pool: infrastructure
38
+ persistent_disk: 8192
39
+ networks:
40
+ - name: default
41
+ static_ips:
42
+ - 172.31.4.10
43
+
44
+ - name: syslog_aggregator
45
+ template: syslog_aggregator
46
+ instances: 1
47
+ resource_pool: infrastructure
48
+ persistent_disk: 600
49
+ networks:
50
+ - name: default
51
+ static_ips:
52
+ - 172.31.4.13
53
+
54
+ properties:
55
+ domain: appcloud23.dev.mozycloud.com
56
+
57
+ nfs_server:
58
+ address: 172.31.4.10
59
+ network: 172.31.4.0/22
60
+
61
+ syslog_aggregator:
62
+ address: 172.31.4.13
63
+ port: 54321
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: <%= find("name") %>
3
+ director_uuid: <%= find("director_uuid")%>
4
+
5
+ networks:
6
+
7
+ - name: default
8
+ subnets:
9
+ <%- for @subnet in find("networks.default.subnets") -%>
10
+ - reserved:
11
+ - <%= ip_range(2..9, "default") %>
12
+ - <%= ip_range(-11..-2, "default") %>
13
+ static:
14
+ - <%= ip_range(10..140, "default") %>
15
+ range: <%= find_in("range", @subnet) %>
16
+ gateway: <%= find_in("gateway", @subnet) %>
17
+ dns:
18
+ <%- for @dns in find_in("dns", @subnet) -%>
19
+ - <%= @dns %>
20
+ <%- end -%>
21
+ cloud_properties:
22
+ name: <%= find_in("cloud_properties.name", @subnet) %>
23
+ <%- end -%>
24
+ - name: lb
25
+ subnets:
26
+ <%- for @subnet in find("networks.lb.subnets") -%>
27
+ - static:
28
+ - <%= ip_range(1..2, "lb") %>
29
+ range: <%= find_in("range", @subnet) %>
30
+ dns:
31
+ <%- for @dns in find_in("dns", @subnet) -%>
32
+ - <%= @dns %>
33
+ <%- end -%>
34
+ cloud_properties:
35
+ name: <%= find_in("cloud_properties.name", @subnet) %>
36
+ <%- end -%>
37
+
38
+ jobs:
39
+
40
+ - name: debian_nfs_server
41
+ template: debian_nfs_server
42
+ instances: 1
43
+ resource_pool: infrastructure
44
+ persistent_disk: 8192
45
+ networks:
46
+ - name: default
47
+ static_ips:
48
+ - <%= ip(10, "default") %>
49
+
50
+ - name: syslog_aggregator
51
+ template: syslog_aggregator
52
+ instances: 1
53
+ resource_pool: infrastructure
54
+ persistent_disk: 600
55
+ networks:
56
+ - name: default
57
+ static_ips:
58
+ - <%= ip(13, "default") %>
59
+
60
+ properties:
61
+ domain: <%= find("properties.domain") %>
62
+
63
+ nfs_server:
64
+ address: <%= ip(10, "default") %>
65
+ network: <%= get_network_and_mask("default") %>
66
+
67
+ syslog_aggregator:
68
+ address: <%= ip(13, "default") %>
69
+ port: 54321
@@ -0,0 +1,40 @@
1
+ ---
2
+ networks:
3
+
4
+ - name: default
5
+ subnets:
6
+ - reserved:
7
+ - 172.31.116.2 - 172.31.116.9
8
+ - 172.31.119.245 - 172.31.119.254
9
+ static:
10
+ - 172.31.116.10 - 172.31.116.140
11
+ range: 172.31.116.0/22
12
+ gateway: 172.31.116.1
13
+ dns:
14
+ - 172.30.22.153
15
+ - 172.30.22.154
16
+ cloud_properties:
17
+ name: VLAN2116
18
+ # This extra subnet doesn't work in Biff.
19
+ - reserved:
20
+ - 172.31.116.2 - 172.31.116.9
21
+ - 172.31.119.245 - 172.31.119.254
22
+ static:
23
+ - 172.31.116.10 - 172.31.116.140
24
+ range: 172.31.116.0/22
25
+ gateway: 172.31.116.1
26
+ dns:
27
+ - 172.30.22.153
28
+ - 172.30.22.154
29
+ cloud_properties:
30
+ name: VLAN2116
31
+ - name: lb
32
+ subnets:
33
+ - static:
34
+ - 172.28.3.145-172.28.3.146
35
+ range: 172.28.3.144/28
36
+ dns:
37
+ - 172.30.22.153
38
+ - 172.30.22.154
39
+ cloud_properties:
40
+ name: VLAN3057
@@ -0,0 +1,34 @@
1
+ ---
2
+
3
+ networks:
4
+
5
+ - name: default
6
+ subnets:
7
+ <%- for @subnet in find("networks.default.subnets") -%>
8
+ - reserved:
9
+ - <%= ip_range(2..9, "default") %>
10
+ - <%= ip_range(-11..-2, "default") %>
11
+ static:
12
+ - <%= ip_range(10..140, "default") %>
13
+ range: <%= find_in("range", @subnet) %>
14
+ gateway: <%= find_in("gateway", @subnet) %>
15
+ dns:
16
+ <%- for @dns in find_in("dns", @subnet) -%>
17
+ - <%= @dns %>
18
+ <%- end -%>
19
+ cloud_properties:
20
+ name: <%= find_in("cloud_properties.name", @subnet) %>
21
+ <%- end -%>
22
+ - name: lb
23
+ subnets:
24
+ <%- for @subnet in find("networks.lb.subnets") -%>
25
+ - static:
26
+ - <%= ip_range(1..2, "lb") %>
27
+ range: <%= find_in("range", @subnet) %>
28
+ dns:
29
+ <%- for @dns in find_in("dns", @subnet) -%>
30
+ - <%= @dns %>
31
+ <%- end -%>
32
+ cloud_properties:
33
+ name: <%= find_in("cloud_properties.name", @subnet) %>
34
+ <%- end -%>
@@ -0,0 +1,27 @@
1
+ ---
2
+ networks:
3
+
4
+ - name: default
5
+ subnets:
6
+ - reserved:
7
+ - 172.31.116.2 - 172.31.116.9
8
+ - 172.31.119.245 - 172.31.119.254
9
+ static:
10
+ - 172.31.116.10 - 172.31.116.140
11
+ range: 172.31.116.0/22
12
+ gateway: 172.31.116.1
13
+ dns:
14
+ - 172.30.22.153
15
+ - 172.30.22.154
16
+ cloud_properties:
17
+ name: VLAN2116
18
+ - name: lb
19
+ subnets:
20
+ - static:
21
+ - 172.28.3.145-172.28.3.146
22
+ range: 172.28.3.144/28
23
+ dns:
24
+ - 172.30.22.153
25
+ - 172.30.22.154
26
+ cloud_properties:
27
+ name: VLAN3057
@@ -0,0 +1,27 @@
1
+ ---
2
+ networks:
3
+
4
+ - name: default
5
+ subnets:
6
+ - reserved:
7
+ - 172.31.116.2 - 172.31.116.9
8
+ - 172.31.119.245 - 172.31.119.254
9
+ static:
10
+ - 172.31.116.10 - 172.31.116.140
11
+ # Range should exist here.
12
+ gateway: 172.31.116.1
13
+ dns:
14
+ - 172.30.22.153
15
+ - 172.30.22.154
16
+ cloud_properties:
17
+ name: VLAN2116
18
+ - name: lb
19
+ subnets:
20
+ - static:
21
+ - 172.28.3.145-172.28.3.146
22
+ range: 172.28.3.144/28
23
+ dns:
24
+ - 172.30.22.153
25
+ - 172.30.22.154
26
+ cloud_properties:
27
+ name: VLAN3057
@@ -0,0 +1,16 @@
1
+ ---
2
+ networks:
3
+
4
+ - name: default
5
+ subnets:
6
+ - name: lb
7
+ subnets:
8
+ - static:
9
+ - 172.28.3.145-172.28.3.146
10
+ range: 172.28.3.144/28
11
+ gateway: 172.31.116.1
12
+ dns:
13
+ - 172.30.22.153
14
+ - 172.30.22.154
15
+ cloud_properties:
16
+ name: VLAN3057
@@ -0,0 +1,30 @@
1
+ ---
2
+
3
+ networks:
4
+
5
+ - name: default
6
+ subnets:
7
+ - reserved:
8
+ - 172.31.116.2 - 172.31.116.9
9
+ - 172.31.119.245 - 172.31.119.254
10
+ range: 172.31.116.0/22
11
+ # Static is out of order so that there is a diff between this and the
12
+ # template.
13
+ static:
14
+ - 172.31.116.10 - 172.31.116.140
15
+ gateway: 172.31.116.1
16
+ dns:
17
+ - 172.30.22.153
18
+ - 172.30.22.154
19
+ cloud_properties:
20
+ name: VLAN2116
21
+ - name: lb
22
+ subnets:
23
+ - static:
24
+ - 172.28.3.145 - 172.28.3.146
25
+ range: 172.28.3.144/28
26
+ dns:
27
+ - 172.30.22.153
28
+ - 172.30.22.154
29
+ cloud_properties:
30
+ name: VLAN3057
@@ -0,0 +1,6 @@
1
+ ---
2
+
3
+ jobs:
4
+ cc:
5
+ srv_api_uri: <%= find("properties.cc.srv_api_uri") %>
6
+ use_nginx: true
File without changes
@@ -0,0 +1,43 @@
1
+ module Bosh::Cli::Command
2
+ class Echo < Base
3
+
4
+ command :banner do
5
+ usage "banner <string>"
6
+ desc "Print a large banner"
7
+ route :echo, :banner
8
+ end
9
+
10
+ command :say do
11
+ usage "say <string> <color>"
12
+ desc "Say something with color"
13
+ option "--color <color>", "color"
14
+ route :echo, :say_color
15
+ end
16
+
17
+ def parse_options(args)
18
+ options = {}
19
+ ["color"].each do |option|
20
+ pos = args.index("--#{option}")
21
+ if pos
22
+ options[option] = args[pos + 1]
23
+ args.delete_at(pos + 1)
24
+ args.delete_at(pos)
25
+ end
26
+ end
27
+ options
28
+ end
29
+
30
+ def banner(string)
31
+ system "banner #{string}"
32
+ end
33
+
34
+ def say_color(*args)
35
+ string = args.shift
36
+ options = parse_options(args)
37
+ if color = options["color"]
38
+ string = string.send(:colorize, color.to_sym)
39
+ end
40
+ say(string)
41
+ end
42
+ end
43
+ end