corl 0.4.15 → 0.4.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 (53) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +6 -1
  3. data/Gemfile.lock +76 -30
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/bootstrap/bootstrap.sh +5 -2
  7. data/bootstrap/os/ubuntu/00_base.sh +1 -1
  8. data/bootstrap/os/ubuntu/01_git.sh +9 -0
  9. data/bootstrap/os/ubuntu/05_ruby.sh +7 -4
  10. data/bootstrap/os/ubuntu/06_puppet.sh +2 -2
  11. data/corl.gemspec +23 -9
  12. data/lib/CORL/action/authorize.rb +2 -5
  13. data/lib/CORL/action/bootstrap.rb +1 -5
  14. data/lib/CORL/action/build.rb +2 -10
  15. data/lib/CORL/action/destroy.rb +2 -7
  16. data/lib/CORL/action/exec.rb +1 -5
  17. data/lib/CORL/action/image.rb +1 -5
  18. data/lib/CORL/action/images.rb +12 -10
  19. data/lib/CORL/action/ip.rb +21 -0
  20. data/lib/CORL/action/lookup.rb +5 -3
  21. data/lib/CORL/action/machines.rb +12 -10
  22. data/lib/CORL/action/provision.rb +4 -7
  23. data/lib/CORL/action/regions.rb +12 -10
  24. data/lib/CORL/action/seed.rb +9 -10
  25. data/lib/CORL/action/spawn.rb +29 -15
  26. data/lib/CORL/action/ssh.rb +1 -5
  27. data/lib/CORL/action/start.rb +1 -5
  28. data/lib/CORL/action/stop.rb +1 -5
  29. data/lib/CORL/action/vagrantfile.rb +55 -0
  30. data/lib/CORL/configuration/file.rb +4 -1
  31. data/lib/CORL/machine/physical.rb +1 -1
  32. data/lib/CORL/machine/vagrant.rb +358 -0
  33. data/lib/CORL/node/local.rb +2 -3
  34. data/lib/CORL/node/vagrant.rb +238 -0
  35. data/lib/core/facade.rb +25 -2
  36. data/lib/core/mixin/macro/network_settings.rb +35 -1
  37. data/lib/core/plugin/action.rb +53 -5
  38. data/lib/core/plugin/configuration.rb +19 -5
  39. data/lib/core/plugin/fog_machine.rb +1 -1
  40. data/lib/core/plugin/fog_node.rb +9 -9
  41. data/lib/core/plugin/machine.rb +6 -13
  42. data/lib/core/plugin/network.rb +23 -7
  43. data/lib/core/plugin/node.rb +69 -36
  44. data/lib/core/plugin/provisioner.rb +1 -2
  45. data/lib/core/vagrant/Vagrantfile +7 -0
  46. data/lib/core/vagrant/commands/launcher.rb +66 -0
  47. data/lib/core/vagrant/config.rb +308 -0
  48. data/lib/core/vagrant/plugins.rb +33 -0
  49. data/lib/core/vagrant/provisioner/config.rb +39 -0
  50. data/lib/core/vagrant/provisioner/provisioner.rb +46 -0
  51. data/lib/corl.rb +8 -0
  52. data/locales/en.yml +13 -1
  53. metadata +120 -59
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b4edb990285aa696910d5e592213b5a91b5e5f6e
4
+ data.tar.gz: de66aaa2bdf8677c6a0eafead3233557326b0595
5
+ SHA512:
6
+ metadata.gz: 953891d538e823b0dd7c29b2b07ca2311a3abce4aab3cb69771e61b17c6bef119d02c87732cc1a84bdc059692c45141b7c78751d88bd4efdd0344faa5c4a2fb6
7
+ data.tar.gz: c92c87e4c910691a82d140ac025d381db9b7cb691f62f024ca4598b8bece484dcfafbcbfd85cb9e63ae2b1c3aee362275ac03aa3cf77404e98d463525c658d76
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "nucleon", "~> 0.1"
3
+ gem "nucleon", "~> 0.1", ">= 0.1.10", :github => 'coralnexus/nucleon', :branch => '0.1'
4
4
 
5
5
  gem "fog", "~> 1.20"
6
6
  gem "unf", "~> 0.1"
@@ -16,4 +16,9 @@ group :development do
16
16
  gem "rspec", "~> 2.10"
17
17
  gem "rdoc", "~> 3.12"
18
18
  gem "yard", "~> 0.8"
19
+ gem "vagrant", "~> 1.5", :github => 'mitchellh/vagrant', :branch => 'master'
20
+ end
21
+
22
+ group :plugins do
23
+ gem "corl", :path => "."
19
24
  end
data/Gemfile.lock CHANGED
@@ -1,15 +1,62 @@
1
+ GIT
2
+ remote: git://github.com/coralnexus/nucleon.git
3
+ revision: 924063f5b5fd6680e438d7b3ea91bc655e7e6837
4
+ branch: 0.1
5
+ specs:
6
+ nucleon (0.1.13)
7
+ celluloid (~> 0.15)
8
+ childprocess (~> 0.5)
9
+ deep_merge (~> 1.0)
10
+ i18n (~> 0.6)
11
+ log4r (~> 1.1)
12
+ multi_json (~> 1.7)
13
+ netrc (~> 0.7)
14
+ octokit (~> 2.7)
15
+ rugged (~> 0.19)
16
+ sshkey (~> 1.6)
17
+
18
+ GIT
19
+ remote: git://github.com/mitchellh/vagrant.git
20
+ revision: e8f1f301e6bab643ae652d2ed1fcee0c6ee820c4
21
+ branch: master
22
+ specs:
23
+ vagrant (1.5.3.dev)
24
+ bundler (~> 1.5.2)
25
+ childprocess (~> 0.5.0)
26
+ erubis (~> 2.7.0)
27
+ i18n (~> 0.6.0)
28
+ listen (~> 2.4.0)
29
+ log4r (~> 1.1.9, < 1.1.11)
30
+ net-scp (~> 1.1.0)
31
+ net-ssh (>= 2.6.6, < 2.8.0)
32
+ rb-kqueue (~> 0.2.0)
33
+ wdm (~> 0.1.0)
34
+
35
+ PATH
36
+ remote: .
37
+ specs:
38
+ corl (0.4.16)
39
+ facter (~> 1.7)
40
+ fog (~> 1.20)
41
+ hiera (~> 1.3)
42
+ nucleon (~> 0.1, >= 0.1.10)
43
+ puppet (~> 3.2)
44
+ unf (~> 0.1)
45
+
1
46
  GEM
2
47
  remote: http://rubygems.org/
3
48
  specs:
4
- addressable (2.3.5)
49
+ addressable (2.3.6)
5
50
  builder (3.2.2)
6
51
  celluloid (0.15.2)
7
52
  timers (~> 1.1.0)
8
- childprocess (0.5.1)
53
+ childprocess (0.5.2)
9
54
  ffi (~> 1.0, >= 1.0.11)
10
55
  deep_merge (1.0.1)
11
- descendants_tracker (0.0.3)
56
+ descendants_tracker (0.0.4)
57
+ thread_safe (~> 0.3, >= 0.3.1)
12
58
  diff-lcs (1.2.5)
59
+ erubis (2.7.0)
13
60
  excon (0.32.1)
14
61
  facter (1.7.5)
15
62
  faraday (0.9.0)
@@ -42,11 +89,7 @@ GEM
42
89
  multi_json (>= 1.7.5, < 2.0)
43
90
  nokogiri (~> 1.6.0)
44
91
  oauth2
45
- grit (2.5.0)
46
- diff-lcs (~> 1.1)
47
- mime-types (~> 1.15)
48
- posix-spawn (~> 0.3.6)
49
- hashie (2.0.5)
92
+ hashie (2.1.0)
50
93
  hiera (1.3.2)
51
94
  json_pure
52
95
  highline (1.6.21)
@@ -64,29 +107,22 @@ GEM
64
107
  json_pure (1.8.1)
65
108
  jwt (0.1.11)
66
109
  multi_json (>= 1.5)
110
+ listen (2.4.1)
111
+ celluloid (>= 0.15.2)
112
+ rb-fsevent (>= 0.9.3)
113
+ rb-inotify (>= 0.9)
67
114
  log4r (1.1.10)
68
- mime-types (1.25.1)
69
- mini_portile (0.5.2)
115
+ mime-types (2.2)
116
+ mini_portile (0.5.3)
70
117
  multi_json (1.9.2)
71
118
  multi_xml (0.5.5)
72
119
  multipart-post (2.0.0)
73
120
  net-scp (1.1.2)
74
121
  net-ssh (>= 2.6.5)
75
- net-ssh (2.8.0)
122
+ net-ssh (2.7.0)
76
123
  netrc (0.7.7)
77
124
  nokogiri (1.6.1)
78
125
  mini_portile (~> 0.5.0)
79
- nucleon (0.1.8)
80
- celluloid (~> 0.15)
81
- childprocess (~> 0.5.0)
82
- deep_merge (~> 1.0)
83
- grit (~> 2.5)
84
- i18n (~> 0.6)
85
- log4r (~> 1.1)
86
- multi_json (~> 1.7)
87
- netrc (~> 0.7)
88
- octokit (~> 2.7)
89
- sshkey (~> 1.6)
90
126
  oauth2 (0.9.3)
91
127
  faraday (>= 0.8, < 0.10)
92
128
  jwt (~> 0.1.8)
@@ -95,13 +131,18 @@ GEM
95
131
  rack (~> 1.2)
96
132
  octokit (2.7.2)
97
133
  sawyer (~> 0.5.2)
98
- posix-spawn (0.3.8)
99
- puppet (3.4.3)
100
- facter (~> 1.6)
134
+ puppet (3.5.0)
135
+ facter (> 1.6, < 3)
101
136
  hiera (~> 1.0)
137
+ json_pure
102
138
  rgen (~> 0.6.5)
103
139
  rack (1.5.2)
104
- rake (10.1.1)
140
+ rake (10.2.2)
141
+ rb-fsevent (0.9.4)
142
+ rb-inotify (0.9.3)
143
+ ffi (>= 0.5.0)
144
+ rb-kqueue (0.2.2)
145
+ ffi (>= 0.5.0)
105
146
  rdoc (3.12.2)
106
147
  json (~> 1.4)
107
148
  rgen (0.6.6)
@@ -113,28 +154,33 @@ GEM
113
154
  rspec-expectations (2.14.5)
114
155
  diff-lcs (>= 1.1.3, < 2.0)
115
156
  rspec-mocks (2.14.6)
116
- sawyer (0.5.3)
157
+ rugged (0.19.0)
158
+ sawyer (0.5.4)
117
159
  addressable (~> 2.3.5)
118
160
  faraday (~> 0.8, < 0.10)
119
161
  sshkey (1.6.1)
162
+ thread_safe (0.3.3)
120
163
  timers (1.1.0)
121
- unf (0.1.3)
164
+ unf (0.1.4)
122
165
  unf_ext
123
166
  unf_ext (0.0.6)
124
- yard (0.8.7.3)
167
+ wdm (0.1.0)
168
+ yard (0.8.7.4)
125
169
 
126
170
  PLATFORMS
127
171
  ruby
128
172
 
129
173
  DEPENDENCIES
130
174
  bundler (~> 1.2)
175
+ corl!
131
176
  facter (~> 1.7)
132
177
  fog (~> 1.20)
133
178
  hiera (~> 1.3)
134
179
  jeweler (~> 2.0)
135
- nucleon (~> 0.1)
180
+ nucleon (~> 0.1, >= 0.1.10)!
136
181
  puppet (~> 3.2)
137
182
  rdoc (~> 3.12)
138
183
  rspec (~> 2.10)
139
184
  unf (~> 0.1)
185
+ vagrant (~> 1.5)!
140
186
  yard (~> 0.8)
data/Rakefile CHANGED
@@ -34,7 +34,7 @@ Jeweler::Tasks.new do |gem|
34
34
  gem.authors = ["Adrian Webb"]
35
35
  gem.summary = %Q{Cluster Orchestration and Research Library}
36
36
  gem.description = %Q{Framework that provides a simple foundation for growing organically in the cloud}
37
- gem.required_ruby_version = '>= 1.8.1'
37
+ gem.required_ruby_version = '>= 2.0'
38
38
  gem.has_rdoc = true
39
39
  gem.rdoc_options << '--title' << 'Cluster Orchestration and Research Library' <<
40
40
  '--main' << 'README.rdoc' <<
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.15
1
+ 0.4.16
@@ -16,6 +16,9 @@ Systems initialized:
16
16
 
17
17
  * Git - Git packages installed
18
18
 
19
+ * Vim - Vim and vim script packages installed
20
+ - Vim configured
21
+
19
22
  * Ruby - Ruby 1.9.x packages installed
20
23
  - Execution alternative configuration (if applicable)
21
24
 
@@ -29,8 +32,8 @@ Systems initialized:
29
32
  Tested under Ubuntu 12.04 LTS
30
33
  Licensed under GPLv3
31
34
 
32
- See the project page at: http://github.com/coralnexus/coral-bootstrap
33
- Report issues here: http://github.com/coralnexus/coral-bootstrap/issues
35
+ See the project page at: http://github.com/coralnexus/corl-bootstrap
36
+ Report issues here: http://github.com/coralnexus/corl-bootstrap/issues
34
37
  "
35
38
  fi
36
39
 
@@ -14,4 +14,4 @@ echo "nameserver 208.67.222.222" | tee /etc/resolvconf/resolv.conf.d/base > /dev
14
14
  apt-get update || exit 4
15
15
 
16
16
  # Install basic build packages.
17
- apt-get -y install build-essential curl || exit 5
17
+ apt-get -y install build-essential python-software-properties curl || exit 5
@@ -3,3 +3,12 @@
3
3
 
4
4
  # Install Git.
5
5
  apt-get -y install git || exit 10
6
+
7
+ echo "Hello $USER"
8
+
9
+ # Make sure it is easy to communicate with repo hosts
10
+ mkdir -p ~/.ssh || exit 11
11
+ touch ~/.ssh/known_hosts || exit 12
12
+
13
+ ssh-keygen -R github.com 2>&1 || exit 13 # No duplicates
14
+ ssh-keyscan -H github.com >> ~/.ssh/known_hosts || exit 14
@@ -2,12 +2,15 @@
2
2
  #-------------------------------------------------------------------------------
3
3
 
4
4
  # Install Ruby.
5
- apt-get -y install ruby1.9.1 ruby1.9.1-dev || exit 50
6
- update-alternatives --set ruby /usr/bin/ruby1.9.1 || exit 51
7
- update-alternatives --set gem /usr/bin/gem1.9.1 || exit 52
5
+ add-apt-repository ppa:brightbox/ruby-ng-experimental 2>&1 || exit 51
6
+ apt-get update || exit 52
7
+
8
+ apt-get -y install ruby2.1 ruby2.1-dev || exit 53
9
+ update-alternatives --set ruby /usr/bin/ruby2.1 || exit 54
10
+ update-alternatives --set gem /usr/bin/gem2.1 || exit 55
8
11
 
9
12
  # Set Gem options
10
13
  ( cat <<'EOP'
11
14
  gem: --no-rdoc --no-ri
12
15
  EOP
13
- ) > "$HOME/.gemrc" || exit 53
16
+ ) > "$HOME/.gemrc" || exit 56
@@ -2,7 +2,7 @@
2
2
  #-------------------------------------------------------------------------------
3
3
 
4
4
  # Set up Puppet Apt repositories
5
- apt-key adv --recv-key --keyserver pgp.mit.edu 4BD6EC30 || exit 60
5
+ apt-key adv --recv-key --keyserver pgp.mit.edu 4BD6EC30 2>&1 || exit 60
6
6
 
7
7
  ( cat <<'EOP'
8
8
  deb http://apt.puppetlabs.com precise main dependencies
@@ -34,4 +34,4 @@ EOP
34
34
  ) > /etc/hiera.yaml || exit 66
35
35
  chmod 0440 /etc/hiera.yaml || exit 67
36
36
 
37
- ln -fs /etc/hiera.yaml /etc/puppet/hiera.yaml || exit 68
37
+ ln -fs /etc/hiera.yaml /etc/puppet/hiera.yaml || exit 68
data/corl.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: corl 0.4.16 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "corl"
8
- s.version = "0.4.15"
9
+ s.version = "0.4.16"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Adrian Webb"]
12
- s.date = "2014-03-24"
14
+ s.date = "2014-04-08"
13
15
  s.description = "Framework that provides a simple foundation for growing organically in the cloud"
14
16
  s.email = "adrian.webb@coralnexus.com"
15
17
  s.executables = ["corl"]
@@ -51,6 +53,7 @@ Gem::Specification.new do |s|
51
53
  "lib/CORL/action/exec.rb",
52
54
  "lib/CORL/action/image.rb",
53
55
  "lib/CORL/action/images.rb",
56
+ "lib/CORL/action/ip.rb",
54
57
  "lib/CORL/action/keypair.rb",
55
58
  "lib/CORL/action/lookup.rb",
56
59
  "lib/CORL/action/machines.rb",
@@ -61,15 +64,18 @@ Gem::Specification.new do |s|
61
64
  "lib/CORL/action/ssh.rb",
62
65
  "lib/CORL/action/start.rb",
63
66
  "lib/CORL/action/stop.rb",
67
+ "lib/CORL/action/vagrantfile.rb",
64
68
  "lib/CORL/configuration/file.rb",
65
69
  "lib/CORL/event/puppet.rb",
66
70
  "lib/CORL/machine/aws.rb",
67
71
  "lib/CORL/machine/physical.rb",
68
72
  "lib/CORL/machine/rackspace.rb",
73
+ "lib/CORL/machine/vagrant.rb",
69
74
  "lib/CORL/network/default.rb",
70
75
  "lib/CORL/node/aws.rb",
71
76
  "lib/CORL/node/local.rb",
72
77
  "lib/CORL/node/rackspace.rb",
78
+ "lib/CORL/node/vagrant.rb",
73
79
  "lib/CORL/provisioner/puppetnode.rb",
74
80
  "lib/CORL/template/environment.rb",
75
81
  "lib/core/errors.rb",
@@ -91,6 +97,12 @@ Gem::Specification.new do |s|
91
97
  "lib/core/util/puppet.rb",
92
98
  "lib/core/util/puppet/resource.rb",
93
99
  "lib/core/util/puppet/resource_group.rb",
100
+ "lib/core/vagrant/Vagrantfile",
101
+ "lib/core/vagrant/commands/launcher.rb",
102
+ "lib/core/vagrant/config.rb",
103
+ "lib/core/vagrant/plugins.rb",
104
+ "lib/core/vagrant/provisioner/config.rb",
105
+ "lib/core/vagrant/provisioner/provisioner.rb",
94
106
  "lib/corl.rb",
95
107
  "lib/facter/corl_build.rb",
96
108
  "lib/facter/corl_config_ready.rb",
@@ -129,17 +141,16 @@ Gem::Specification.new do |s|
129
141
  s.homepage = "http://github.com/coralnexus/corl"
130
142
  s.licenses = ["GPLv3"]
131
143
  s.rdoc_options = ["--title", "Cluster Orchestration and Research Library", "--main", "README.rdoc", "--line-numbers"]
132
- s.require_paths = ["lib"]
133
- s.required_ruby_version = Gem::Requirement.new(">= 1.8.1")
144
+ s.required_ruby_version = Gem::Requirement.new(">= 2.0")
134
145
  s.rubyforge_project = "corl"
135
- s.rubygems_version = "1.8.11"
146
+ s.rubygems_version = "2.2.2"
136
147
  s.summary = "Cluster Orchestration and Research Library"
137
148
 
138
149
  if s.respond_to? :specification_version then
139
- s.specification_version = 3
150
+ s.specification_version = 4
140
151
 
141
152
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
142
- s.add_runtime_dependency(%q<nucleon>, ["~> 0.1"])
153
+ s.add_runtime_dependency(%q<nucleon>, [">= 0.1.10", "~> 0.1"])
143
154
  s.add_runtime_dependency(%q<fog>, ["~> 1.20"])
144
155
  s.add_runtime_dependency(%q<unf>, ["~> 0.1"])
145
156
  s.add_runtime_dependency(%q<facter>, ["~> 1.7"])
@@ -150,8 +161,9 @@ Gem::Specification.new do |s|
150
161
  s.add_development_dependency(%q<rspec>, ["~> 2.10"])
151
162
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
152
163
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
164
+ s.add_development_dependency(%q<vagrant>, ["~> 1.5"])
153
165
  else
154
- s.add_dependency(%q<nucleon>, ["~> 0.1"])
166
+ s.add_dependency(%q<nucleon>, [">= 0.1.10", "~> 0.1"])
155
167
  s.add_dependency(%q<fog>, ["~> 1.20"])
156
168
  s.add_dependency(%q<unf>, ["~> 0.1"])
157
169
  s.add_dependency(%q<facter>, ["~> 1.7"])
@@ -162,9 +174,10 @@ Gem::Specification.new do |s|
162
174
  s.add_dependency(%q<rspec>, ["~> 2.10"])
163
175
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
164
176
  s.add_dependency(%q<yard>, ["~> 0.8"])
177
+ s.add_dependency(%q<vagrant>, ["~> 1.5"])
165
178
  end
166
179
  else
167
- s.add_dependency(%q<nucleon>, ["~> 0.1"])
180
+ s.add_dependency(%q<nucleon>, [">= 0.1.10", "~> 0.1"])
168
181
  s.add_dependency(%q<fog>, ["~> 1.20"])
169
182
  s.add_dependency(%q<unf>, ["~> 0.1"])
170
183
  s.add_dependency(%q<facter>, ["~> 1.7"])
@@ -175,6 +188,7 @@ Gem::Specification.new do |s|
175
188
  s.add_dependency(%q<rspec>, ["~> 2.10"])
176
189
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
177
190
  s.add_dependency(%q<yard>, ["~> 0.8"])
191
+ s.add_dependency(%q<vagrant>, ["~> 1.5"])
178
192
  end
179
193
  end
180
194
 
@@ -8,8 +8,7 @@ class Authorize < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure,
12
- :key_store_failure
11
+ codes :key_store_failure
13
12
 
14
13
  register :public_key, :str, nil
15
14
  end
@@ -28,7 +27,7 @@ class Authorize < Plugin::CloudAction
28
27
  super do |node, network|
29
28
  info('corl.actions.authorize.start')
30
29
 
31
- if network && node
30
+ ensure_node(node) do
32
31
  ssh_path = Util::SSH.key_path
33
32
  authorized_keys = File.join(ssh_path, 'authorized_keys')
34
33
  public_key = settings[:public_key].strip
@@ -47,8 +46,6 @@ class Authorize < Plugin::CloudAction
47
46
  myself.status = code.key_store_failure
48
47
  end
49
48
  end
50
- else
51
- myself.status = code.network_failure
52
49
  end
53
50
  end
54
51
  end
@@ -8,8 +8,6 @@ class Bootstrap < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure
12
-
13
11
  register :auth_files, :array, [] do |values|
14
12
  success = true
15
13
  values.each do |value|
@@ -69,7 +67,7 @@ class Bootstrap < Plugin::CloudAction
69
67
 
70
68
  def execute
71
69
  super do |local_node, network|
72
- if network
70
+ ensure_network(network) do
73
71
  batch_success = network.batch(settings[:bootstrap_nodes], settings[:node_provider], settings[:parallel]) do |node|
74
72
  render_options = { :id => node.id, :hostname => node.hostname }
75
73
 
@@ -84,8 +82,6 @@ class Bootstrap < Plugin::CloudAction
84
82
  success
85
83
  end
86
84
  myself.status = code.batch_error unless batch_success
87
- else
88
- myself.status = code.network_failure
89
85
  end
90
86
  end
91
87
  end
@@ -6,22 +6,14 @@ class Build < Plugin::CloudAction
6
6
  #-----------------------------------------------------------------------------
7
7
  # Settings
8
8
 
9
- def configure
10
- super do
11
- codes :network_failure
12
- end
13
- end
14
-
15
9
  #-----------------------------------------------------------------------------
16
10
  # Operations
17
11
 
18
12
  def execute
19
13
  super do |node, network|
20
- if network && node
21
- info('corl.actions.build.start')
14
+ info('corl.actions.build.start')
15
+ ensure_node(node) do
22
16
  node.build
23
- else
24
- myself.status = code.network_failure
25
17
  end
26
18
  end
27
19
  end
@@ -8,8 +8,6 @@ class Destroy < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure
12
-
13
11
  register :destroy_nodes, :array, nil do |values|
14
12
  if values.nil?
15
13
  warn('corl.actions.destroy.errors.destroy_nodes_empty')
@@ -47,15 +45,12 @@ class Destroy < Plugin::CloudAction
47
45
 
48
46
  def execute
49
47
  super do |local_node, network|
50
- info('corl.actions.destroy.start')
51
-
52
- if network
48
+ ensure_network(network) do
53
49
  batch_success = network.batch(settings[:destroy_nodes], settings[:node_provider], settings[:parallel]) do |node|
50
+ info('corl.actions.stop.start', { :provider => node.plugin_provider, :name => node.plugin_name })
54
51
  node.destroy
55
52
  end
56
53
  myself.status = code.batch_error unless batch_success
57
- else
58
- myself.status = code.network_failure
59
54
  end
60
55
  end
61
56
  end
@@ -8,8 +8,6 @@ class Exec < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure
12
-
13
11
  register :command, :array, nil
14
12
  end
15
13
  end
@@ -25,7 +23,7 @@ class Exec < Plugin::CloudAction
25
23
 
26
24
  def execute
27
25
  super do |node, network|
28
- if network && node
26
+ ensure_node(node) do
29
27
  if settings[:command].length > 1
30
28
  settings[:command].collect! do |value|
31
29
  if value.strip.match(/\s+/)
@@ -38,8 +36,6 @@ class Exec < Plugin::CloudAction
38
36
  command_str = settings[:command].join(' ')
39
37
  result = node.exec({ :commands => [ command_str ] }).first
40
38
  myself.status = result.status
41
- else
42
- myself.status = code.network_failure
43
39
  end
44
40
  end
45
41
  end
@@ -8,8 +8,6 @@ class Image < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure
12
-
13
11
  register :image_nodes, :array, nil do |values|
14
12
  if values.nil?
15
13
  warn('corl.actions.image.errors.image_nodes_empty')
@@ -47,14 +45,12 @@ class Image < Plugin::CloudAction
47
45
 
48
46
  def execute
49
47
  super do |local_node, network|
50
- if network
48
+ ensure_network(network) do
51
49
  batch_success = network.batch(settings[:image_nodes], settings[:node_provider], settings[:parallel]) do |node|
52
50
  info('corl.actions.image.start', { :provider => node.plugin_provider, :name => node.plugin_name })
53
51
  node.create_image
54
52
  end
55
53
  myself.status = code.batch_error unless batch_success
56
- else
57
- myself.status = code.network_failure
58
54
  end
59
55
  end
60
56
  end
@@ -35,19 +35,21 @@ class Images < Plugin::CloudAction
35
35
  super do |local_node, network|
36
36
  info('corl.actions.images.start')
37
37
 
38
- if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
39
- if images = node.images(settings[:search], settings)
40
- images.each do |image|
41
- render(node.render_image(image), { :prefix => false })
42
- end
38
+ ensure_network(network) do
39
+ if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
40
+ if images = node.images(settings[:search], settings)
41
+ images.each do |image|
42
+ render(node.render_image(image), { :prefix => false })
43
+ end
43
44
 
44
- myself.result = images
45
- success('corl.actions.images.results', { :images => images.length }) if images.length > 1
45
+ myself.result = images
46
+ success('corl.actions.images.results', { :images => images.length }) if images.length > 1
47
+ else
48
+ myself.status = code.image_load_failure
49
+ end
46
50
  else
47
- myself.status = code.image_load_failure
51
+ myself.status = code.node_load_failure
48
52
  end
49
- else
50
- myself.status = code.node_load_failure
51
53
  end
52
54
  end
53
55
  end
@@ -0,0 +1,21 @@
1
+
2
+ module CORL
3
+ module Action
4
+ class Ip < Plugin::CloudAction
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Settings
8
+
9
+ #-----------------------------------------------------------------------------
10
+ # Operations
11
+
12
+ def execute
13
+ super do |node, network|
14
+ ensure_node(node) do
15
+ ui.info(CORL.public_ip)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -23,10 +23,12 @@ class Lookup < Plugin::CloudAction
23
23
 
24
24
  def execute
25
25
  super do |node, network|
26
- property = settings[:property]
27
- value = node.lookup(property)
26
+ ensure_node(node) do
27
+ property = settings[:property]
28
+ value = node.lookup(property)
28
29
 
29
- node.render(sprintf("#{property} = %s", value.inspect))
30
+ ui.info(sprintf("#{property} = %s", value.inspect))
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -30,19 +30,21 @@ class Machines < Plugin::CloudAction
30
30
  super do |local_node, network|
31
31
  info('corl.actions.machines.start')
32
32
 
33
- if node = network.test_node(settings[:node_provider])
34
- if machine_types = node.machine_types
35
- machine_types.each do |machine_type|
36
- render(node.render_machine_type(machine_type), { :prefix => false })
37
- end
33
+ ensure_network(network) do
34
+ if node = network.test_node(settings[:node_provider])
35
+ if machine_types = node.machine_types
36
+ machine_types.each do |machine_type|
37
+ render(node.render_machine_type(machine_type), { :prefix => false })
38
+ end
38
39
 
39
- myself.result = machine_types
40
- success('corl.actions.machines.results', { :machines => machine_types.length }) if machine_types.length > 1
40
+ myself.result = machine_types
41
+ success('corl.actions.machines.results', { :machines => machine_types.length }) if machine_types.length > 1
42
+ else
43
+ myself.status = code.machine_load_failure
44
+ end
41
45
  else
42
- myself.status = code.machine_load_failure
46
+ myself.status = code.node_load_failure
43
47
  end
44
- else
45
- myself.status = code.node_load_failure
46
48
  end
47
49
  end
48
50
  end