vagabond 0.2.8 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/CHANGELOG.md +16 -0
  2. data/DEVELOP.md +38 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +33 -0
  5. data/README.md +55 -21
  6. data/USAGE.md +28 -3
  7. data/Vagabondfile.sample +47 -0
  8. data/Vagrantfile +17 -5
  9. data/bin/vagabond +5 -0
  10. data/lib/vagabond/Cheffile +7 -0
  11. data/lib/vagabond/Cheffile.dev +7 -0
  12. data/lib/vagabond/actions/cluster.rb +22 -8
  13. data/lib/vagabond/actions/create.rb +7 -4
  14. data/lib/vagabond/actions/destroy.rb +24 -14
  15. data/lib/vagabond/actions/freeze.rb +1 -0
  16. data/lib/vagabond/actions/init.rb +8 -11
  17. data/lib/vagabond/actions/provision.rb +16 -8
  18. data/lib/vagabond/actions/rebuild.rb +4 -9
  19. data/lib/vagabond/actions/ssh.rb +9 -1
  20. data/lib/vagabond/actions/start.rb +1 -0
  21. data/lib/vagabond/actions/status.rb +1 -0
  22. data/lib/vagabond/actions/thaw.rb +1 -0
  23. data/lib/vagabond/actions/up.rb +22 -7
  24. data/lib/vagabond/bootstraps/chef_10_compat_config.erb +62 -0
  25. data/lib/vagabond/bootstraps/no_lazy_load.erb +63 -0
  26. data/lib/vagabond/bootstraps/server-zero.erb +1 -8
  27. data/lib/vagabond/bootstraps/server.erb +9 -6
  28. data/lib/vagabond/constants.rb +1 -6
  29. data/lib/vagabond/core.rb +209 -0
  30. data/lib/vagabond/errors.rb +3 -0
  31. data/lib/vagabond/helpers.rb +11 -99
  32. data/lib/vagabond/helpers/base.rb +134 -0
  33. data/lib/vagabond/helpers/callbacks.rb +47 -0
  34. data/lib/vagabond/helpers/chains.rb +23 -0
  35. data/lib/vagabond/helpers/commands.rb +49 -0
  36. data/lib/vagabond/helpers/knife.rb +47 -0
  37. data/lib/vagabond/helpers/naming.rb +39 -0
  38. data/lib/vagabond/helpers/server.rb +30 -0
  39. data/lib/vagabond/internal_configuration.rb +186 -32
  40. data/lib/vagabond/kitchen.rb +110 -60
  41. data/lib/vagabond/knife.rb +5 -1
  42. data/lib/vagabond/layout.rb +1 -0
  43. data/lib/vagabond/monkey/kitchen_config.rb +1 -0
  44. data/lib/vagabond/notify_mash.rb +25 -0
  45. data/lib/vagabond/server.rb +81 -49
  46. data/lib/vagabond/settings.rb +17 -0
  47. data/lib/vagabond/spec.rb +125 -99
  48. data/lib/vagabond/uploader.rb +4 -1
  49. data/lib/vagabond/uploader/berkshelf.rb +2 -1
  50. data/lib/vagabond/uploader/knife.rb +3 -9
  51. data/lib/vagabond/uploader/librarian.rb +2 -5
  52. data/lib/vagabond/vagabond.rb +77 -93
  53. data/lib/vagabond/vagabondfile.rb +73 -9
  54. data/lib/vagabond/version.rb +2 -1
  55. data/vagabond.gemspec +7 -5
  56. metadata +58 -81
  57. data/lib/vagabond/cookbooks/apt/Berksfile +0 -8
  58. data/lib/vagabond/cookbooks/apt/CHANGELOG.md +0 -97
  59. data/lib/vagabond/cookbooks/apt/CONTRIBUTING +0 -29
  60. data/lib/vagabond/cookbooks/apt/LICENSE +0 -201
  61. data/lib/vagabond/cookbooks/apt/README.md +0 -243
  62. data/lib/vagabond/cookbooks/apt/TESTING.md +0 -25
  63. data/lib/vagabond/cookbooks/apt/attributes/default.rb +0 -4
  64. data/lib/vagabond/cookbooks/apt/files/default/apt-proxy-v2.conf +0 -50
  65. data/lib/vagabond/cookbooks/apt/metadata.rb +0 -30
  66. data/lib/vagabond/cookbooks/apt/providers/preference.rb +0 -61
  67. data/lib/vagabond/cookbooks/apt/providers/repository.rb +0 -132
  68. data/lib/vagabond/cookbooks/apt/recipes/cacher-client.rb +0 -59
  69. data/lib/vagabond/cookbooks/apt/recipes/cacher-ng.rb +0 -40
  70. data/lib/vagabond/cookbooks/apt/recipes/default.rb +0 -68
  71. data/lib/vagabond/cookbooks/apt/resources/preference.rb +0 -30
  72. data/lib/vagabond/cookbooks/apt/resources/repository.rb +0 -40
  73. data/lib/vagabond/cookbooks/apt/templates/debian-6.0/acng.conf.erb +0 -174
  74. data/lib/vagabond/cookbooks/apt/templates/default/01proxy.erb +0 -2
  75. data/lib/vagabond/cookbooks/apt/templates/default/acng.conf.erb +0 -276
  76. data/lib/vagabond/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +0 -270
  77. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/README.md +0 -1
  78. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/cacher-ng_test.rb +0 -28
  79. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/default_test.rb +0 -28
  80. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/lwrps_test.rb +0 -48
  81. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/support/helpers.rb +0 -29
  82. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/metadata.rb +0 -6
  83. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/cacher-ng.rb +0 -20
  84. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/default.rb +0 -20
  85. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/lwrps.rb +0 -66
  86. data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +0 -37
  87. data/lib/vagabond/cookbooks/lxc/Gemfile +0 -4
  88. data/lib/vagabond/cookbooks/lxc/Gemfile.lock +0 -41
  89. data/lib/vagabond/cookbooks/lxc/README.md +0 -112
  90. data/lib/vagabond/cookbooks/lxc/attributes/default.rb +0 -26
  91. data/lib/vagabond/cookbooks/lxc/files/default/knife_lxc +0 -228
  92. data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +0 -499
  93. data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +0 -477
  94. data/lib/vagabond/cookbooks/lxc/libraries/lxc_expanded_resources.rb +0 -40
  95. data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +0 -84
  96. data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +0 -51
  97. data/lib/vagabond/cookbooks/lxc/metadata.rb +0 -12
  98. data/lib/vagabond/cookbooks/lxc/providers/config.rb +0 -75
  99. data/lib/vagabond/cookbooks/lxc/providers/container.rb +0 -354
  100. data/lib/vagabond/cookbooks/lxc/providers/default.rb +0 -57
  101. data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +0 -40
  102. data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +0 -30
  103. data/lib/vagabond/cookbooks/lxc/providers/interface.rb +0 -45
  104. data/lib/vagabond/cookbooks/lxc/providers/service.rb +0 -53
  105. data/lib/vagabond/cookbooks/lxc/recipes/containers.rb +0 -13
  106. data/lib/vagabond/cookbooks/lxc/recipes/default.rb +0 -58
  107. data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +0 -15
  108. data/lib/vagabond/cookbooks/lxc/recipes/knife.rb +0 -37
  109. data/lib/vagabond/cookbooks/lxc/resources/config.rb +0 -19
  110. data/lib/vagabond/cookbooks/lxc/resources/container.rb +0 -54
  111. data/lib/vagabond/cookbooks/lxc/resources/default.rb +0 -12
  112. data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +0 -13
  113. data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +0 -12
  114. data/lib/vagabond/cookbooks/lxc/resources/interface.rb +0 -13
  115. data/lib/vagabond/cookbooks/lxc/resources/service.rb +0 -5
  116. data/lib/vagabond/cookbooks/lxc/templates/default/client.rb.erb +0 -13
  117. data/lib/vagabond/cookbooks/lxc/templates/default/default-lxc.erb +0 -3
  118. data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +0 -2
  119. data/lib/vagabond/cookbooks/lxc/templates/default/fstab.erb +0 -5
  120. data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +0 -27
  121. data/lib/vagabond/cookbooks/vagabond/README.md +0 -10
  122. data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +0 -18
  123. data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +0 -460
  124. data/lib/vagabond/cookbooks/vagabond/libraries/vagabond.rb +0 -10
  125. data/lib/vagabond/cookbooks/vagabond/metadata.rb +0 -8
  126. data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +0 -132
  127. data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +0 -9
  128. data/lib/vagabond/helpers/cheffile_loader.rb +0 -20
  129. data/vagabond-0.2.6.gem +0 -0
@@ -1,3 +1,19 @@
1
+ ## v0.2.10
2
+ * Fix `:berkshelf` key to be optionally Hash type
3
+ * Allow all types for roles/environments/data bags
4
+ * Add guards for uploads of file types (thanks @jaypipes)
5
+ * Raise exception on failed provisions
6
+ * Force utf-8 on all files
7
+ * Better output on parallel cluster builds
8
+ * Use Librarian to vendor internal cookbooks at runtime
9
+ * Provide `spec` support within isolated cookbooks (outside of chef-repo)
10
+ * Make `server` nodes ephemeral
11
+ * Build base erchef server containers with versions
12
+ * Customize host provisioning cookbook versions based on dev/release version
13
+ * Added callbacks
14
+ * Allow passing commands to nodes via `ssh` action
15
+ * Lots of cleanup and other stuff that's not jumping out of the git history
16
+
1
17
  ## v0.2.8
2
18
  * Disable `chef-server` clone on provision (#14)
3
19
  * Temporarily disable provision on init action
@@ -0,0 +1,38 @@
1
+ # Hacking Vagabond
2
+
3
+ Here's some useful notes about hacking on Vagabond
4
+
5
+ ## Git branch
6
+
7
+ Unstable development is on the `develop` branch. Pull requests should
8
+ be based on the `develop` branch and any changes will be merged there
9
+ prior to being merged into `master`. The `master` branch will always
10
+ be the currently stable released version.
11
+
12
+ ## Versioning
13
+
14
+ Stable versions will always be even numbered patch levels. Unstable
15
+ versions will always be odd numbered patch levels.
16
+
17
+ ### Unstable behavior
18
+
19
+ When unstable versions are detected vagabond will provision the system
20
+ differently than when within stable versions. The Cheffile used to vendor
21
+ cookbooks for provisioning the host will use cookbook linked to unstable
22
+ versions of the cookbooks, and these will be updated every hour.
23
+
24
+ Since stable versions of vagabond will link directly to released versions
25
+ of cookbooks, a single update to pull the dependencies is sufficient. In
26
+ development mode with cookbooks linked to changing cookbooks, getting updates
27
+ will be required as the code is updated.
28
+
29
+ ## Debugging
30
+
31
+ Vagabond will not print stacktraces by default when an error is encountered.
32
+ To enable stacktraces on errors, set the environment variable `VAGABOND_EXIT_DEBUG`
33
+ prior to running a command. Alternatively you can export the variable so it
34
+ will always be set:
35
+
36
+ ```
37
+ $ export VAGABOND_EXIT_DEBUG=true
38
+ ```
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant', :tag => 'v1.2.1'
@@ -0,0 +1,33 @@
1
+ GIT
2
+ remote: git://github.com/mitchellh/vagrant
3
+ revision: a7853fe7b7f08dbedbc934eb9230d33be6bf746f
4
+ tag: v1.2.1
5
+ specs:
6
+ vagrant (1.2.1)
7
+ childprocess (~> 0.3.7)
8
+ erubis (~> 2.7.0)
9
+ i18n (~> 0.6.0)
10
+ json (>= 1.5.1, < 1.8.0)
11
+ log4r (~> 1.1.9)
12
+ net-scp (~> 1.1.0)
13
+ net-ssh (~> 2.6.6)
14
+
15
+ GEM
16
+ remote: https://rubygems.org/
17
+ specs:
18
+ childprocess (0.3.9)
19
+ ffi (~> 1.0, >= 1.0.11)
20
+ erubis (2.7.0)
21
+ ffi (1.9.3)
22
+ i18n (0.6.5)
23
+ json (1.7.7)
24
+ log4r (1.1.10)
25
+ net-scp (1.1.2)
26
+ net-ssh (>= 2.6.5)
27
+ net-ssh (2.6.8)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ vagrant!
data/README.md CHANGED
@@ -38,33 +38,47 @@ Hash you return. Heres a simple example:
38
38
  :nodes => {
39
39
  :precise => {
40
40
  :template => 'ubuntu_1204',
41
- :run_list => %w(role[base])
42
- },
43
- :db => {
44
- :template => 'ubuntu_1204',
45
- :run_list => %w(role[db])
41
+ :run_list => ['role[base]']
46
42
  }
47
43
  },
48
- :local_chef_server => {
44
+ :server => {
49
45
  :enabled => true,
50
- :auto_upload => true
46
+ :auto_upload => true,
47
+ :librarian => true,
48
+ :berkshelf => false
51
49
  }
52
50
  }
53
51
  ```
52
+ We can also use the `describe` DSL instead of building hashes directly:
54
53
 
54
+ ```ruby
55
+ Vagabond::Vagabondfile.describe do
56
+ nodes do
57
+ precise do
58
+ template 'ubuntu_1204'
59
+ run_list ['role[base]']
60
+ end
61
+ end
62
+ server do
63
+ enabled true
64
+ auto_upload true
65
+ librarian true
66
+ berkshelf false
67
+ end
68
+ end
69
+ ```
55
70
  Now, to create a node, simply run:
56
71
 
57
72
  ```
58
- $ vagabond up db
73
+ $ vagabond up precise
59
74
  ```
60
75
 
61
- This command will bootstrap the installation of LXC utilities and base
62
- containers prior to starting up a linux container. It does this by
63
- running the vagabond chef recipe embedded in this gem at
64
- `lib/vagabond/cookbooks/vagabond/recipes/default.rb`.
76
+ ## System preparation
65
77
 
66
- To only prepare your system for LXC fun and generate a simple vagabond
67
- file, do the following:
78
+ Vagabond will provision the host system automatically as required to create
79
+ required base lxc templates and ensure proper configuration. However, we can
80
+ also initialize the system directly and create required base images using the
81
+ `init` action:
68
82
 
69
83
  ```
70
84
  $ vagabond init
@@ -72,8 +86,9 @@ $ vagabond init
72
86
 
73
87
  This command runs the chef recipe and generates a basic Vagabondfile and
74
88
  creates the base containers specified in that file. Those base
75
- containers are Ubuntu 12.04 and CentOS 6.3. This creation process will
76
- take a while so now is a good time to get a fresh pot of coffee.
89
+ containers are Ubuntu 12.04 and CentOS 6. This creation process can
90
+ take a while depending on download speeds so now is a good time to get a
91
+ fresh pot of coffee.
77
92
 
78
93
  Pretty simple, right?
79
94
 
@@ -81,13 +96,13 @@ Pretty simple, right?
81
96
 
82
97
  Currently builtin templates:
83
98
 
99
+ * ubuntu_1004
84
100
  * ubuntu_1204
85
101
  * ubuntu_1210
86
102
  * debian_6
87
103
  * debian_7
88
- * centos_58
89
- * centos_63
90
- * centos_64
104
+ * centos_5
105
+ * centos_6
91
106
 
92
107
  ## Commands
93
108
 
@@ -106,6 +121,19 @@ local server option is enabled. It's just an important bit of information
106
121
  to remember so you can make a mental note to stop or freeze it when not
107
122
  in use. Or just let them run. What ever floats your boat.
108
123
 
124
+ ### Lightweight chef server
125
+
126
+ Vagabond also supports chef-zero instead of running a full blown erchef
127
+ instance. You can specify this by setting it within the `server` block:
128
+
129
+ ```ruby
130
+ ...
131
+ server do
132
+ zero true
133
+ end
134
+ ...
135
+ ```
136
+
109
137
  ### Vagabond knife
110
138
 
111
139
  Since you can have a local chef server running, it can also be helpful
@@ -215,7 +243,7 @@ keys can be repeated `n` times to provide multiple nodes of a specific type.
215
243
  ### Usage
216
244
 
217
245
  ```
218
- $ vagabond spec my_cluster
246
+ $ vagabond spec start my_cluster
219
247
  ```
220
248
 
221
249
  ### Applying specs
@@ -242,7 +270,7 @@ against actual live infrastructure to see if it is currently in a valid
242
270
  state based on existing specs. Awesome!
243
271
 
244
272
  ```
245
- $ vagabond spec my_cluster --environment production
273
+ $ vagabond spec start my_cluster --irl --environment production
246
274
  ```
247
275
 
248
276
  ## Important note
@@ -262,6 +290,10 @@ boring old `sudo`, you can do that to:
262
290
  :sudo => 'rvmsudo'
263
291
  ```
264
292
 
293
+ Vagabond will attempt to be smart about determining how to sudo. So if the
294
+ `sudo` option is not set (`nil`) it will discover its environment and use
295
+ `sudo` or `rvmsudo` accordingly.
296
+
265
297
  ## Extra note
266
298
 
267
299
  This thing is still very new and shiny with lots of sharp edges. They
@@ -286,4 +318,6 @@ get help making things better!
286
318
 
287
319
  ## Infos
288
320
 
321
+ * Issues: https://github.com/chrisroberts/vagabond/issues
289
322
  * Repository: https://github.com/chrisroberts/vagabond
323
+ * IRC: #vagabond @ Freenode
data/USAGE.md CHANGED
@@ -73,6 +73,23 @@ to then use that template:
73
73
  }
74
74
  ```
75
75
 
76
+ ## Assigning static IP addresses to nodes
77
+
78
+ Nodes can be assigned static IP addresses using the `:ipaddress` key in
79
+ the node's Hash:
80
+
81
+ ```ruby
82
+ {
83
+ :nodes => {
84
+ :my_precise_node => {
85
+ :template => 'ubuntu_1204',
86
+ :run_list => ['role[base]'],
87
+ :ipaddress => '10.0.0.10'
88
+ }
89
+ }
90
+ ...
91
+ ```
92
+
76
93
  ## vagabond
77
94
 
78
95
  The `vagabond` command is used for interaction with nodes. Simply running:
@@ -92,6 +109,12 @@ provide the name and it will drop you into a root session:
92
109
  $ vagabond ssh my_precise_node
93
110
  ```
94
111
 
112
+ or run a command remotely on the given node:
113
+
114
+ ```
115
+ $ vagabond ssh my_precise_node ps -AH ux
116
+ ```
117
+
95
118
  ## vagabond server
96
119
 
97
120
  Vagabond will optionally allow the installation of a chef server that is
@@ -107,7 +130,7 @@ look like this:
107
130
  :run_list => ['role[base]']
108
131
  }
109
132
  },
110
- :local_chef_server => {
133
+ :server => {
111
134
  :enabled => true
112
135
  }
113
136
  }
@@ -120,11 +143,13 @@ Vagabond. The server commands are explicitly for the server container.
120
143
  The commands are similar to the basic `vagabond` commands, with a few
121
144
  extra commands as well.
122
145
 
123
- The `:local_chef_server` hash also has two helper keys for setting up
146
+ The `:server` hash has a few helper keys for setting up
124
147
  the server:
125
148
 
126
149
  * `:auto_upload` - Uploads all cookbooks, roles, data bags and environments after build
127
150
  * `:berkshelf` - Uses berkshelf for cookbook upload instead of knife
151
+ * `:librarian` - Uses librarian for cookbook upload instead of knife
152
+ * `:zero` - Uses Chef Zero instead of Chef 11 (erchef)
128
153
 
129
154
  ## vagabond knife
130
155
 
@@ -194,4 +219,4 @@ Simple, yet so very very awesome. \o/
194
219
 
195
220
  Testing support is still very young, just like Vagabond. But there are plans
196
221
  in the works for more features. Take a look at the issues section in github
197
- with `kitchen` tags. Feel free to add more if you see something missing!
222
+ with `kitchen` tags. Feel free to add more if you see something missing!
@@ -0,0 +1,47 @@
1
+ Vagabond::Vagabondfile.describe do
2
+ defaults do
3
+ template 'ubuntu_1204'
4
+ environment 'testing'
5
+ run_list ['recipe[apt]']
6
+ end
7
+ definitions do
8
+ database do
9
+ template 'ubuntu_1204'
10
+ run_list ['recipe[internal::db]']
11
+ end
12
+ web_site do
13
+ run_list ['recipe[internal::website]']
14
+ attributes do
15
+ apache do
16
+ ports %w(80 443)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ nodes do
22
+ db do
23
+ definition 'database'
24
+ environment 'production'
25
+ custom_specs %w(blah blah blah)
26
+ end
27
+ db_slave.definition 'database'
28
+ db_slave.attributes.internal.database.role 'slave'
29
+ end
30
+ clusters do
31
+ db ['db', 'db_slave']
32
+ end
33
+ specs.clusters do
34
+ db do
35
+ overrides.environment 'staging'
36
+ provision do
37
+ times 4
38
+ spec :after_2, :after_4
39
+ after(2) do
40
+ run.on.db '/usr/bin/fail_database'
41
+ pause 3
42
+ end
43
+ after.every.run '/usr/bin/log_database_state'
44
+ end
45
+ end
46
+ end
47
+ end
@@ -2,9 +2,15 @@
2
2
  # vi: set ft=ruby :
3
3
 
4
4
  Vagrant.configure("2") do |config|
5
- config.vm.hostname = "sensu-lxc-host"
6
- config.vm.box = 'precise-64-lxc-preseed'
7
- config.vm.box_url = 'http://vagrant.hw-ops.com/precise-64-lxc-preseed.box'
5
+ config.vm.hostname = "vagabond-lxc-host"
6
+
7
+ unless(ENV['DISABLE_PRESEED'])
8
+ config.vm.box = 'precise-64-lxc-preseed'
9
+ config.vm.box_url = 'http://vagrant.hw-ops.com/precise-64-lxc-preseed.box'
10
+ else
11
+ config.vm.box = 'precise-64'
12
+ config.vm.box_url = 'https://github.com/downloads/chrisroberts/vagrant-boxes/precise-64.box'
13
+ end
8
14
 
9
15
  if(ENV['ENABLE_APT_PROXY'])
10
16
  proxy = [
@@ -20,9 +26,15 @@ Vagrant.configure("2") do |config|
20
26
  proxy + [
21
27
  "lxc-destroy -n ubuntu_1204",
22
28
  "apt-get update",
23
- "apt-get install -y -q ruby1.9.1-full git",
29
+ "apt-get install -y -q python-software-properties git build-essential",
30
+ "add-apt-repository ppa:brightbox/ruby-ng",
31
+ "apt-get update",
32
+ "apt-get install -y -q ruby1.9.1 ruby1.9.1-dev",
24
33
  "gem install --no-ri --no-rdoc bundler",
25
- "gem install --no-ri --no-rdoc vagabond"
34
+ "cd /home/vagrant",
35
+ %(echo "source 'https://rubygems.org'\ngem 'vagabond', path: '/vagrant'\n" > Gemfile),
36
+ "bundle install --binstubs",
37
+ "chown -R vagrant:vagrant /home/vagrant"
26
38
  ]
27
39
  ).join("\n")
28
40
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ #encoding: utf-8
2
3
 
3
4
  Signal.trap('INT'){ exit 255 }
4
5
 
@@ -44,6 +45,10 @@ else
44
45
  Vagabond::Vagabond
45
46
  end.start
46
47
  rescue Vagabond::VagabondError => e
48
+ $stderr.puts "Vagabond error encountered. Exiting: #{e}"
49
+ if(ENV['VAGABOND_EXIT_DEBUG'])
50
+ puts "#{e.class}: #{e}\n#{e.backtrace.join("\n")}"
51
+ end
47
52
  exit e.exit_code
48
53
  rescue Exception => e
49
54
  $stderr.puts "Vagabond exiting. Reason: #{e}"
@@ -0,0 +1,7 @@
1
+ site 'http://community.opscode.com/api/v1'
2
+
3
+ cookbook 'vagabond', '1.0.4'
4
+ cookbook 'lxc', '1.1.4'
5
+ cookbook 'chef-server-populator', '0.3.0'
6
+
7
+ cookbook 'chef-server', '2.0.0'
@@ -0,0 +1,7 @@
1
+ site 'http://community.opscode.com/api/v1'
2
+
3
+ cookbook 'vagabond', git: 'git://github.com/chrisroberts/chef-vagabond.git', ref: 'develop'
4
+ cookbook 'lxc', git: 'git://github.com/hw-cookbooks/lxc.git', ref: 'develop'
5
+ cookbook 'chef-server-populator', git: 'git://github.com/hw-cookbooks/chef-server-populator.git', ref: 'develop'
6
+
7
+ cookbook 'chef-server', '2.0.0'
@@ -1,3 +1,4 @@
1
+ #encoding: utf-8
1
2
  module Vagabond
2
3
  module Actions
3
4
  module Cluster
@@ -33,20 +34,22 @@ module Vagabond
33
34
  clr = vagabondfile[:clusters][name] if vagabondfile[:clusters]
34
35
  if(clr)
35
36
  ui.info "#{ui.color('Vagabond:', :bold)} Building cluster - #{ui.color(name, :green)}"
36
- if(vagabondfile[:local_chef_server] && vagabondfile[:local_chef_server][:enabled])
37
+ if(vagabondfile.local_chef_server?)
37
38
  require 'vagabond/server'
38
39
  srv = ::Vagabond::Server.new
39
- srv.send(:setup, 'up')
40
- srv.execute
41
- # Reload so we get proper values
42
- load_configurations
40
+ srv.options = options.dup
41
+ srv.options[:auto_provision] = true
42
+ unless(srv.lxc.running?)
43
+ srv.up
44
+ # Reload so we get proper values
45
+ configure
46
+ end
43
47
  end
44
48
  cluster_instances = clr.map do |n|
45
49
  ui.info "Building #{n} for cluster!"
46
50
  v_inst = Vagabond.new
47
51
  v_inst.options = options.dup
48
- v_inst.send(:setup, 'up', n, :ui => ui)
49
- v_inst.execute
52
+ v_inst.up(n, :ui => ui)
50
53
  if(options[:delay].to_i > 0 && n != clr.last)
51
54
  ui.warn "Delay requested between node processing. Sleeping for #{options[:delay].to_i} seconds."
52
55
  sleep(options[:delay].to_i)
@@ -59,7 +62,18 @@ module Vagabond
59
62
  inst.wait_for_completion
60
63
  end
61
64
  end
62
- ui.info " -> #{ui.color("Built cluster #{name}", :green)}"
65
+ failed = cluster_instances.map{|i|i.send(:tasks)}.map(&:values).flatten.detect do |hash|
66
+ hash[:result] == false
67
+ end
68
+ result = failed ? ['FAILED', :red, :bold] : ['SUCCESS', :green, :bold]
69
+ ui.info "\nCluster build #{name}: #{ui.color(*result)}"
70
+ cluster_instances.each do |inst|
71
+ failed = inst.send(:tasks).values.flatten.detect do |hash|
72
+ hash[:result] == false
73
+ end
74
+ result = failed ? ['FAILED', :red, :bold] : ['SUCCESS', :green, :bold]
75
+ ui.info " -> #{inst.name}: #{ui.color(*result)}"
76
+ end
63
77
  else
64
78
  ui.error "Cluster name provided does not exist: #{name}"
65
79
  end