corl 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.gitmodules +1 -1
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +15 -8
  4. data/VERSION +1 -1
  5. data/bootstrap/os/ubuntu/00_base.sh +10 -1
  6. data/bootstrap/os/ubuntu/05_ruby.sh +6 -0
  7. data/bootstrap/os/ubuntu/06_puppet.sh +6 -6
  8. data/bootstrap/os/ubuntu/09_nucleon.sh +14 -0
  9. data/bootstrap/os/ubuntu/10_corl.sh +7 -2
  10. data/corl.gemspec +16 -9
  11. data/lib/CORL/action/authorize.rb +57 -0
  12. data/lib/CORL/action/bootstrap.rb +5 -0
  13. data/lib/CORL/action/destroy.rb +64 -0
  14. data/lib/CORL/action/exec.rb +9 -0
  15. data/lib/CORL/action/image.rb +39 -7
  16. data/lib/CORL/action/images.rb +4 -3
  17. data/lib/CORL/action/lookup.rb +2 -2
  18. data/lib/CORL/action/regions.rb +51 -0
  19. data/lib/CORL/action/seed.rb +1 -1
  20. data/lib/CORL/action/spawn.rb +8 -9
  21. data/lib/CORL/action/ssh.rb +74 -0
  22. data/lib/CORL/action/start.rb +37 -5
  23. data/lib/CORL/action/stop.rb +37 -5
  24. data/lib/CORL/configuration/file.rb +34 -7
  25. data/lib/CORL/event/puppet.rb +1 -1
  26. data/lib/CORL/machine/aws.rb +153 -0
  27. data/lib/CORL/machine/physical.rb +14 -5
  28. data/lib/CORL/machine/rackspace.rb +58 -0
  29. data/lib/CORL/network/default.rb +1 -1
  30. data/lib/CORL/node/aws.rb +40 -16
  31. data/lib/CORL/node/local.rb +4 -3
  32. data/lib/CORL/node/rackspace.rb +25 -7
  33. data/lib/CORL/provisioner/puppetnode.rb +11 -9
  34. data/lib/core/errors.rb +6 -0
  35. data/lib/core/mod/fog_aws_server.rb +38 -0
  36. data/lib/core/plugin/action.rb +3 -11
  37. data/lib/core/plugin/configuration.rb +20 -2
  38. data/lib/{CORL/machine/fog.rb → core/plugin/fog_machine.rb} +92 -92
  39. data/lib/core/plugin/{fog.rb → fog_node.rb} +20 -7
  40. data/lib/core/plugin/machine.rb +58 -37
  41. data/lib/core/plugin/network.rb +76 -111
  42. data/lib/core/plugin/node.rb +271 -87
  43. data/lib/core/plugin/provisioner.rb +1 -1
  44. data/lib/corl.rb +6 -14
  45. data/locales/en.yml +18 -1
  46. metadata +39 -32
  47. data/lib/CORL/node/google.rb +0 -111
  48. data/lib/core/util/ssh.rb +0 -286
data/.gitmodules CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  [submodule "bootstrap"]
3
3
  path = bootstrap
4
- url = git://github.com/coralnexus/coral-bootstrap.git
4
+ url = git://github.com/coralnexus/corl-bootstrap.git
data/Gemfile CHANGED
@@ -2,8 +2,8 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "nucleon", "~> 0.1"
4
4
 
5
- gem "sshkey", "~> 1.6"
6
5
  gem "fog", "~> 1.20"
6
+ gem "unf", "~> 0.1"
7
7
 
8
8
  gem "facter", "~> 1.7"
9
9
  gem "hiera", "~> 1.3"
data/Gemfile.lock CHANGED
@@ -5,6 +5,8 @@ GEM
5
5
  builder (3.2.2)
6
6
  celluloid (0.15.2)
7
7
  timers (~> 1.1.0)
8
+ childprocess (0.5.1)
9
+ ffi (~> 1.0, >= 1.0.11)
8
10
  deep_merge (1.0.1)
9
11
  descendants_tracker (0.0.3)
10
12
  diff-lcs (1.2.5)
@@ -12,6 +14,7 @@ GEM
12
14
  facter (1.7.5)
13
15
  faraday (0.9.0)
14
16
  multipart-post (>= 1.2, < 3)
17
+ ffi (1.9.3)
15
18
  fog (1.20.0)
16
19
  builder
17
20
  excon (~> 0.31.0)
@@ -36,9 +39,9 @@ GEM
36
39
  mime-types (~> 1.15)
37
40
  posix-spawn (~> 0.3.6)
38
41
  hashie (2.0.5)
39
- hiera (1.3.1)
42
+ hiera (1.3.2)
40
43
  json_pure
41
- highline (1.6.20)
44
+ highline (1.6.21)
42
45
  i18n (0.6.9)
43
46
  jeweler (2.0.1)
44
47
  builder
@@ -56,7 +59,7 @@ GEM
56
59
  log4r (1.1.10)
57
60
  mime-types (1.25.1)
58
61
  mini_portile (0.5.2)
59
- multi_json (1.8.4)
62
+ multi_json (1.9.0)
60
63
  multi_xml (0.5.5)
61
64
  multipart-post (2.0.0)
62
65
  net-scp (1.1.2)
@@ -65,8 +68,9 @@ GEM
65
68
  netrc (0.7.7)
66
69
  nokogiri (1.6.1)
67
70
  mini_portile (~> 0.5.0)
68
- nucleon (0.1.3)
71
+ nucleon (0.1.4)
69
72
  celluloid (~> 0.15)
73
+ childprocess (~> 0.5.0)
70
74
  deep_merge (~> 1.0)
71
75
  grit (~> 2.5)
72
76
  i18n (~> 0.6)
@@ -74,14 +78,14 @@ GEM
74
78
  multi_json (~> 1.7)
75
79
  netrc (~> 0.7)
76
80
  octokit (~> 2.7)
77
- rgen (~> 0.6)
81
+ sshkey (~> 1.6)
78
82
  oauth2 (0.9.3)
79
83
  faraday (>= 0.8, < 0.10)
80
84
  jwt (~> 0.1.8)
81
85
  multi_json (~> 1.3)
82
86
  multi_xml (~> 0.5)
83
87
  rack (~> 1.2)
84
- octokit (2.7.1)
88
+ octokit (2.7.2)
85
89
  sawyer (~> 0.5.2)
86
90
  posix-spawn (0.3.8)
87
91
  puppet (3.4.3)
@@ -97,7 +101,7 @@ GEM
97
101
  rspec-core (~> 2.14.0)
98
102
  rspec-expectations (~> 2.14.0)
99
103
  rspec-mocks (~> 2.14.0)
100
- rspec-core (2.14.7)
104
+ rspec-core (2.14.8)
101
105
  rspec-expectations (2.14.5)
102
106
  diff-lcs (>= 1.1.3, < 2.0)
103
107
  rspec-mocks (2.14.6)
@@ -106,6 +110,9 @@ GEM
106
110
  faraday (~> 0.8, < 0.10)
107
111
  sshkey (1.6.1)
108
112
  timers (1.1.0)
113
+ unf (0.1.3)
114
+ unf_ext
115
+ unf_ext (0.0.6)
109
116
  yard (0.8.7.3)
110
117
 
111
118
  PLATFORMS
@@ -121,5 +128,5 @@ DEPENDENCIES
121
128
  puppet (~> 3.2)
122
129
  rdoc (~> 3.12)
123
130
  rspec (~> 2.10)
124
- sshkey (~> 1.6)
131
+ unf (~> 0.1)
125
132
  yard (~> 0.8)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -1,5 +1,14 @@
1
1
  #!/bin/bash
2
2
  #-------------------------------------------------------------------------------
3
3
 
4
+ # Set hostname
5
+ echo "$HOSTNAME" > "/etc/hostname" || exit 1
6
+
7
+ sed -ri 's/127\.0\.1\.1.*//' /etc/hosts
8
+ echo "127.0.1.1 $HOSTNAME" >> /etc/hosts || exit 2
9
+
10
+ # Update system packages
11
+ apt-get update || exit 3
12
+
4
13
  # Install basic build packages.
5
- apt-get -y install build-essential || exit 1
14
+ apt-get -y install build-essential || exit 4
@@ -5,3 +5,9 @@
5
5
  apt-get -y install ruby1.9.1 ruby1.9.1-dev || exit 50
6
6
  update-alternatives --set ruby /usr/bin/ruby1.9.1 || exit 51
7
7
  update-alternatives --set gem /usr/bin/gem1.9.1 || exit 52
8
+
9
+ # Set Gem options
10
+ ( cat <<'EOP'
11
+ gem: --no-rdoc --no-ri
12
+ EOP
13
+ ) > "$HOME/.gemrc" || exit 53
@@ -8,8 +8,8 @@ apt-key adv --recv-key --keyserver pgp.mit.edu 4BD6EC30 || exit 60
8
8
  deb http://apt.puppetlabs.com precise main dependencies
9
9
  deb-src http://apt.puppetlabs.com precise main dependencies
10
10
  EOP
11
- ) > /etc/apt/sources.list.d/coral_puppet.list || exit 61
12
- chmod 0644 /etc/apt/sources.list.d/coral_puppet.list || exit 62
11
+ ) > /etc/apt/sources.list.d/puppet.list || exit 61
12
+ chmod 0644 /etc/apt/sources.list.d/puppet.list || exit 62
13
13
 
14
14
  # Install Puppet
15
15
  apt-get -y update || exit 63
@@ -17,7 +17,7 @@ apt-get -y install puppet || exit 64
17
17
  gem install libshadow || exit 65
18
18
 
19
19
  # Set up Hiera configuration
20
- mkdir -p /var/coral/config || exit 66
20
+ mkdir -p /var/corl/config || exit 66
21
21
 
22
22
  ( cat <<'EOP'
23
23
  ---
@@ -26,13 +26,13 @@ mkdir -p /var/coral/config || exit 66
26
26
  - yaml
27
27
  - json
28
28
  :yaml:
29
- :datadir: /var/coral/config
29
+ :datadir: /var/corl/config
30
30
  :json:
31
- :datadir: /var/coral/config
31
+ :datadir: /var/corl/config
32
32
  :hierarchy:
33
33
  - common
34
34
  EOP
35
35
  ) > /etc/hiera.yaml || exit 67
36
36
  chmod 0440 /etc/hiera.yaml || exit 68
37
37
 
38
- cp /etc/hiera.yaml /etc/puppet/hiera.yaml || exit 69
38
+ ln -fs /etc/hiera.yaml /etc/puppet/hiera.yaml || exit 69
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ #-------------------------------------------------------------------------------
3
+
4
+ # For now we install Nucleon through the repo for testing purposes
5
+
6
+ # Install the nucleon gem
7
+ rm -Rf /tmp/nucleon
8
+ mkdir /tmp/nucleon || exit 90
9
+
10
+ cd /tmp/nucleon || exit 101
11
+ git clone --branch 0.1 git://github.com/coralnexus/nucleon.git /tmp/nucleon || exit 91
12
+ git submodule update --init --recursive || exit 92
13
+ gem build /tmp/nucleon/nucleon.gemspec || exit 93
14
+ gem install /tmp/nucleon/nucleon-*.gem || exit 94
@@ -1,9 +1,14 @@
1
1
  #!/bin/bash
2
2
  #-------------------------------------------------------------------------------
3
3
 
4
+ # For now we install CORL through the repo for testing purposes
5
+
4
6
  # Install the corl gem
5
7
  rm -Rf /tmp/corl
6
8
  mkdir /tmp/corl || exit 100
7
9
 
8
- git clone --branch 0.4 git://github.com/coralnexus/corl.git /tmp/corl || exit 101
9
- gem install /tmp/corl/corl-*.gem || exit 102
10
+ cd /tmp/corl || exit 101
11
+ git clone --branch 0.4 git://github.com/coralnexus/corl.git /tmp/corl || exit 102
12
+ git submodule update --init --recursive || exit 103
13
+ gem build /tmp/corl/corl.gemspec || exit 104
14
+ gem install /tmp/corl/corl-*.gem || exit 105
data/corl.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "corl"
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adrian Webb"]
12
- s.date = "2014-02-23"
12
+ s.date = "2014-03-05"
13
13
  s.description = "Framework that provides a simple foundation for growing organically in the cloud"
14
14
  s.email = "adrian.webb@coralnexus.com"
15
15
  s.executables = ["corl"]
@@ -40,45 +40,52 @@ Gem::Specification.new do |s|
40
40
  "bootstrap/os/ubuntu/01_git.sh",
41
41
  "bootstrap/os/ubuntu/05_ruby.sh",
42
42
  "bootstrap/os/ubuntu/06_puppet.sh",
43
+ "bootstrap/os/ubuntu/09_nucleon.sh",
43
44
  "bootstrap/os/ubuntu/10_corl.sh",
44
45
  "corl.gemspec",
46
+ "lib/CORL/action/authorize.rb",
45
47
  "lib/CORL/action/bootstrap.rb",
48
+ "lib/CORL/action/destroy.rb",
46
49
  "lib/CORL/action/exec.rb",
47
50
  "lib/CORL/action/image.rb",
48
51
  "lib/CORL/action/images.rb",
49
52
  "lib/CORL/action/lookup.rb",
50
53
  "lib/CORL/action/machines.rb",
51
54
  "lib/CORL/action/provision.rb",
55
+ "lib/CORL/action/regions.rb",
52
56
  "lib/CORL/action/seed.rb",
53
57
  "lib/CORL/action/spawn.rb",
58
+ "lib/CORL/action/ssh.rb",
54
59
  "lib/CORL/action/start.rb",
55
60
  "lib/CORL/action/stop.rb",
56
61
  "lib/CORL/configuration/file.rb",
57
62
  "lib/CORL/event/puppet.rb",
58
63
  "lib/CORL/extension/puppetloader.rb",
59
- "lib/CORL/machine/fog.rb",
64
+ "lib/CORL/machine/aws.rb",
60
65
  "lib/CORL/machine/physical.rb",
66
+ "lib/CORL/machine/rackspace.rb",
61
67
  "lib/CORL/network/default.rb",
62
68
  "lib/CORL/node/aws.rb",
63
- "lib/CORL/node/google.rb",
64
69
  "lib/CORL/node/local.rb",
65
70
  "lib/CORL/node/rackspace.rb",
66
71
  "lib/CORL/provisioner/puppetnode.rb",
67
72
  "lib/CORL/provisioner/puppetnode/resource.rb",
68
73
  "lib/CORL/provisioner/puppetnode/resource_group.rb",
69
74
  "lib/CORL/template/environment.rb",
75
+ "lib/core/errors.rb",
70
76
  "lib/core/facade.rb",
71
77
  "lib/core/mixin/action/keypair.rb",
72
78
  "lib/core/mixin/lookup.rb",
79
+ "lib/core/mod/fog_aws_server.rb",
73
80
  "lib/core/mod/hiera_backend.rb",
74
81
  "lib/core/plugin/action.rb",
75
82
  "lib/core/plugin/configuration.rb",
76
- "lib/core/plugin/fog.rb",
83
+ "lib/core/plugin/fog_machine.rb",
84
+ "lib/core/plugin/fog_node.rb",
77
85
  "lib/core/plugin/machine.rb",
78
86
  "lib/core/plugin/network.rb",
79
87
  "lib/core/plugin/node.rb",
80
88
  "lib/core/plugin/provisioner.rb",
81
- "lib/core/util/ssh.rb",
82
89
  "lib/corl.rb",
83
90
  "lib/facter/corl_config_ready.rb",
84
91
  "lib/facter/corl_exists.rb",
@@ -125,8 +132,8 @@ Gem::Specification.new do |s|
125
132
 
126
133
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
127
134
  s.add_runtime_dependency(%q<nucleon>, ["~> 0.1"])
128
- s.add_runtime_dependency(%q<sshkey>, ["~> 1.6"])
129
135
  s.add_runtime_dependency(%q<fog>, ["~> 1.20"])
136
+ s.add_runtime_dependency(%q<unf>, ["~> 0.1"])
130
137
  s.add_runtime_dependency(%q<facter>, ["~> 1.7"])
131
138
  s.add_runtime_dependency(%q<hiera>, ["~> 1.3"])
132
139
  s.add_runtime_dependency(%q<puppet>, ["~> 3.2"])
@@ -137,8 +144,8 @@ Gem::Specification.new do |s|
137
144
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
138
145
  else
139
146
  s.add_dependency(%q<nucleon>, ["~> 0.1"])
140
- s.add_dependency(%q<sshkey>, ["~> 1.6"])
141
147
  s.add_dependency(%q<fog>, ["~> 1.20"])
148
+ s.add_dependency(%q<unf>, ["~> 0.1"])
142
149
  s.add_dependency(%q<facter>, ["~> 1.7"])
143
150
  s.add_dependency(%q<hiera>, ["~> 1.3"])
144
151
  s.add_dependency(%q<puppet>, ["~> 3.2"])
@@ -150,8 +157,8 @@ Gem::Specification.new do |s|
150
157
  end
151
158
  else
152
159
  s.add_dependency(%q<nucleon>, ["~> 0.1"])
153
- s.add_dependency(%q<sshkey>, ["~> 1.6"])
154
160
  s.add_dependency(%q<fog>, ["~> 1.20"])
161
+ s.add_dependency(%q<unf>, ["~> 0.1"])
155
162
  s.add_dependency(%q<facter>, ["~> 1.7"])
156
163
  s.add_dependency(%q<hiera>, ["~> 1.3"])
157
164
  s.add_dependency(%q<puppet>, ["~> 3.2"])
@@ -0,0 +1,57 @@
1
+
2
+ module CORL
3
+ module Action
4
+ class Authorize < Plugin::CloudAction
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Settings
8
+
9
+ def configure
10
+ super do
11
+ codes :network_failure,
12
+ :key_store_failure
13
+
14
+ register :public_key, :str, nil
15
+ end
16
+ end
17
+
18
+ #---
19
+
20
+ def arguments
21
+ [ :public_key ]
22
+ end
23
+
24
+ #-----------------------------------------------------------------------------
25
+ # Operations
26
+
27
+ def execute
28
+ super do |node, network|
29
+ info('corl.actions.authorize.start')
30
+
31
+ if network && node
32
+ ssh_path = Util::SSH.key_path
33
+ authorized_keys = File.join(ssh_path, 'authorized_keys')
34
+ public_key = settings[:public_key].strip
35
+ key_found = false
36
+
37
+ if File.exists?(authorized_keys)
38
+ Util::Disk.read(authorized_keys).split("\n").each do |line|
39
+ if line.strip.include?(public_key)
40
+ key_found = true
41
+ break
42
+ end
43
+ end
44
+ end
45
+ unless key_found
46
+ unless Util::Disk.write(authorized_keys, "#{public_key}\n", { :mode => 'a' })
47
+ myself.status = code.key_store_failure
48
+ end
49
+ end
50
+ else
51
+ myself.status = code.network_failure
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -33,6 +33,11 @@ class Bootstrap < Plugin::CloudAction
33
33
  register :bootstrap_init, :str, 'bootstrap.sh'
34
34
 
35
35
  register :bootstrap_nodes, :array, nil do |values|
36
+ if values.nil?
37
+ warn('corl.actions.bootstrap.errors.bootstrap_nodes_empty')
38
+ next false
39
+ end
40
+
36
41
  node_plugins = CORL.loaded_plugins(:node)
37
42
  success = true
38
43
 
@@ -0,0 +1,64 @@
1
+
2
+ module CORL
3
+ module Action
4
+ class Destroy < Plugin::CloudAction
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Settings
8
+
9
+ def configure
10
+ super do
11
+ codes :network_failure
12
+
13
+ register :destroy_nodes, :array, nil do |values|
14
+ if values.nil?
15
+ warn('corl.actions.destroy.errors.destroy_nodes_empty')
16
+ next false
17
+ end
18
+
19
+ node_plugins = CORL.loaded_plugins(:node)
20
+ success = true
21
+
22
+ values.each do |value|
23
+ if info = CORL.plugin_class(:node).translate_reference(value)
24
+ if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
25
+ warn('corl.actions.destroy.errors.destroy_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
26
+ success = false
27
+ end
28
+ end
29
+ end
30
+ success
31
+ end
32
+ end
33
+ end
34
+
35
+ #---
36
+
37
+ def ignore
38
+ [ :nodes ]
39
+ end
40
+
41
+ def arguments
42
+ [ :destroy_nodes ]
43
+ end
44
+
45
+ #-----------------------------------------------------------------------------
46
+ # Operations
47
+
48
+ def execute
49
+ super do |local_node, network|
50
+ info('corl.actions.destroy.start')
51
+
52
+ if network
53
+ batch_success = network.batch(settings[:destroy_nodes], settings[:node_provider], settings[:parallel]) do |node|
54
+ node.destroy
55
+ end
56
+ myself.status = code.batch_error unless batch_success
57
+ else
58
+ myself.status = code.network_failure
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -26,6 +26,15 @@ class Exec < Plugin::CloudAction
26
26
  def execute
27
27
  super do |node, network|
28
28
  if network && node
29
+ if settings[:command].length > 1
30
+ settings[:command].collect! do |value|
31
+ if value.strip.match(/\s+/)
32
+ value = "\"#{value}\""
33
+ end
34
+ value
35
+ end
36
+ end
37
+
29
38
  command_str = settings[:command].join(' ')
30
39
  result = node.exec({ :commands => [ command_str ] }).first
31
40
  myself.status = result.status
@@ -8,19 +8,51 @@ class Image < Plugin::CloudAction
8
8
 
9
9
  def configure
10
10
  super do
11
- codes :network_failure
11
+ codes :network_failure
12
+
13
+ register :image_nodes, :array, nil do |values|
14
+ if values.nil?
15
+ warn('corl.actions.image.errors.image_nodes_empty')
16
+ next false
17
+ end
18
+
19
+ node_plugins = CORL.loaded_plugins(:node)
20
+ success = true
21
+
22
+ values.each do |value|
23
+ if info = CORL.plugin_class(:node).translate_reference(value)
24
+ if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
25
+ warn('corl.actions.image.errors.image_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
26
+ success = false
27
+ end
28
+ end
29
+ end
30
+ success
31
+ end
12
32
  end
13
33
  end
14
-
34
+
35
+ #---
36
+
37
+ def ignore
38
+ [ :nodes ]
39
+ end
40
+
41
+ def arguments
42
+ [ :image_nodes ]
43
+ end
44
+
15
45
  #-----------------------------------------------------------------------------
16
46
  # Operations
17
47
 
18
48
  def execute
19
- super do |node, network|
20
- info('corl.actions.image.start')
21
-
22
- if network && node
23
-
49
+ super do |local_node, network|
50
+ if network
51
+ batch_success = network.batch(settings[:image_nodes], settings[:node_provider], settings[:parallel]) do |node|
52
+ info('corl.actions.image.start', { :provider => node.plugin_provider, :name => node.plugin_name })
53
+ node.create_image
54
+ end
55
+ myself.status = code.batch_error unless batch_success
24
56
  else
25
57
  myself.status = code.network_failure
26
58
  end
@@ -10,9 +10,10 @@ class Images < Plugin::CloudAction
10
10
  super do
11
11
  codes :node_load_failure,
12
12
  :image_load_failure
13
-
13
+
14
+ register :region, :str, nil
14
15
  register :match_case, :bool, false
15
- register :require_all, :bool, false
16
+ register :require_all, :bool, true
16
17
  register :search, :array, []
17
18
  end
18
19
  end
@@ -34,7 +35,7 @@ class Images < Plugin::CloudAction
34
35
  super do |local_node, network|
35
36
  info('corl.actions.images.start')
36
37
 
37
- if node = network.test_node(settings[:node_provider])
38
+ if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
38
39
  if images = node.images(settings[:search], settings)
39
40
  images.each do |image|
40
41
  render(node.render_image(image), { :prefix => false })
@@ -24,9 +24,9 @@ class Lookup < Plugin::CloudAction
24
24
  def execute
25
25
  super do |node, network|
26
26
  property = settings[:property]
27
- value = lookup(property)
27
+ value = node.lookup(property)
28
28
 
29
- render(sprintf("#{property} = %s", value.inspect))
29
+ node.render(sprintf("#{property} = %s", value.inspect))
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,51 @@
1
+
2
+ module CORL
3
+ module Action
4
+ class Regions < Plugin::CloudAction
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Settings
8
+
9
+ def configure
10
+ super do
11
+ codes :node_load_failure,
12
+ :region_load_failure
13
+ end
14
+ end
15
+
16
+ #---
17
+
18
+ def ignore
19
+ node_ignore - [ :node_provider ]
20
+ end
21
+
22
+ def arguments
23
+ [ :node_provider ]
24
+ end
25
+
26
+ #-----------------------------------------------------------------------------
27
+ # Operations
28
+
29
+ def execute
30
+ super do |local_node, network|
31
+ info('corl.actions.regions.start')
32
+
33
+ if node = network.test_node(settings[:node_provider])
34
+ if regions = node.regions
35
+ regions.each do |region|
36
+ render(sprintf("> %s", region), { :prefix => false })
37
+ end
38
+
39
+ myself.result = regions
40
+ success('corl.actions.regions.results', { :regions => regions.length }) if regions.length > 1
41
+ else
42
+ myself.status = code.region_load_failure
43
+ end
44
+ else
45
+ myself.status = code.node_load_failure
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -86,7 +86,7 @@ class Seed < Plugin::CloudAction
86
86
  render("Reinitializing network")
87
87
  if network = init_network
88
88
  if network.load
89
- if node = network.local_node
89
+ if node = network.local_node(true)
90
90
  render("Updating node network configurations")
91
91
  myself.status = code.node_save_failure unless node.save
92
92
  else
@@ -13,21 +13,20 @@ class Spawn < Plugin::CloudAction
13
13
  codes :network_failure,
14
14
  :key_failure,
15
15
  :node_create_failure
16
-
16
+
17
+ register :groups, :array, []
17
18
  register :region, :str, nil
18
19
  register :machine_type, :str, nil
19
- register :image, :str, nil
20
+ register :image, :str, nil
21
+ register :user, :str, :root
20
22
  register :hostnames, :array, nil
21
23
 
22
24
  keypair_config
23
25
 
24
- bootstrap = CORL.action_config(:bootstrap)
25
- config.defaults(bootstrap.config) if bootstrap
26
+ config.defaults(CORL.action_config(:bootstrap))
27
+ config.defaults(CORL.action_config(:seed))
26
28
 
27
- if seed = CORL.action_config(:seed)
28
- seed.config[:project_reference].default = "github:::coraltech/cluster-test[master]"
29
- config.defaults(seed.config)
30
- end
29
+ config[:project_reference].default = "github:::coraltech/cluster-test[master]"
31
30
  end
32
31
  end
33
32
 
@@ -52,7 +51,7 @@ class Spawn < Plugin::CloudAction
52
51
  if keypair && keypair_clean
53
52
  results = []
54
53
  node_provider = settings.delete(:node_provider)
55
-
54
+
56
55
  settings.delete(:hostnames).each do |hostname|
57
56
  if settings[:parallel]
58
57
  results << network.future.add_node(node_provider, hostname, settings)