corl 0.4.16 → 0.4.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4edb990285aa696910d5e592213b5a91b5e5f6e
4
- data.tar.gz: de66aaa2bdf8677c6a0eafead3233557326b0595
3
+ metadata.gz: 7f85f65c16fb13179e2a8b095eb32405cc380d0e
4
+ data.tar.gz: 03aafb7bbc09d7430714188aa08eaf38a84952bd
5
5
  SHA512:
6
- metadata.gz: 953891d538e823b0dd7c29b2b07ca2311a3abce4aab3cb69771e61b17c6bef119d02c87732cc1a84bdc059692c45141b7c78751d88bd4efdd0344faa5c4a2fb6
7
- data.tar.gz: c92c87e4c910691a82d140ac025d381db9b7cb691f62f024ca4598b8bece484dcfafbcbfd85cb9e63ae2b1c3aee362275ac03aa3cf77404e98d463525c658d76
6
+ metadata.gz: f35af71d60106c4fb0aef663b7b672fe500699f57daddc583cca739fffb6f3762b9700a85da78df842230b5e01cb1c561f80ddb5a141ffc66158d2b20aedc998
7
+ data.tar.gz: 1192b85dc7fd5397b4cb2ffb2dd5736b54dddf3539be45005688476e3f81f8babf24fb700552919ef4004b2cd1de1a6f51f0a395041b7c0ad7143be8edebb221
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GIT
2
2
  remote: git://github.com/coralnexus/nucleon.git
3
- revision: 924063f5b5fd6680e438d7b3ea91bc655e7e6837
3
+ revision: f665008257c0307125812676a84ebe2820e05398
4
4
  branch: 0.1
5
5
  specs:
6
- nucleon (0.1.13)
6
+ nucleon (0.1.14)
7
7
  celluloid (~> 0.15)
8
8
  childprocess (~> 0.5)
9
9
  deep_merge (~> 1.0)
@@ -17,7 +17,7 @@ GIT
17
17
 
18
18
  GIT
19
19
  remote: git://github.com/mitchellh/vagrant.git
20
- revision: e8f1f301e6bab643ae652d2ed1fcee0c6ee820c4
20
+ revision: ec35190cfc920dc816b446f1845060d819d5a7c2
21
21
  branch: master
22
22
  specs:
23
23
  vagrant (1.5.3.dev)
@@ -25,7 +25,7 @@ GIT
25
25
  childprocess (~> 0.5.0)
26
26
  erubis (~> 2.7.0)
27
27
  i18n (~> 0.6.0)
28
- listen (~> 2.4.0)
28
+ listen (~> 2.7.1)
29
29
  log4r (~> 1.1.9, < 1.1.11)
30
30
  net-scp (~> 1.1.0)
31
31
  net-ssh (>= 2.6.6, < 2.8.0)
@@ -35,7 +35,7 @@ GIT
35
35
  PATH
36
36
  remote: .
37
37
  specs:
38
- corl (0.4.16)
38
+ corl (0.4.17)
39
39
  facter (~> 1.7)
40
40
  fog (~> 1.20)
41
41
  hiera (~> 1.3)
@@ -50,6 +50,9 @@ GEM
50
50
  builder (3.2.2)
51
51
  celluloid (0.15.2)
52
52
  timers (~> 1.1.0)
53
+ celluloid-io (0.15.0)
54
+ celluloid (>= 0.15.0)
55
+ nio4r (>= 0.5.0)
53
56
  childprocess (0.5.2)
54
57
  ffi (~> 1.0, >= 1.0.11)
55
58
  deep_merge (1.0.1)
@@ -67,7 +70,7 @@ GEM
67
70
  fog-core (~> 1.21, >= 1.21.1)
68
71
  fog-json
69
72
  nokogiri (~> 1.5, >= 1.5.11)
70
- fog-brightbox (0.0.1)
73
+ fog-brightbox (0.0.2)
71
74
  fog-core
72
75
  fog-json
73
76
  fog-core (1.21.1)
@@ -89,7 +92,7 @@ GEM
89
92
  multi_json (>= 1.7.5, < 2.0)
90
93
  nokogiri (~> 1.6.0)
91
94
  oauth2
92
- hashie (2.1.0)
95
+ hashie (2.1.1)
93
96
  hiera (1.3.2)
94
97
  json_pure
95
98
  highline (1.6.21)
@@ -107,8 +110,9 @@ GEM
107
110
  json_pure (1.8.1)
108
111
  jwt (0.1.11)
109
112
  multi_json (>= 1.5)
110
- listen (2.4.1)
113
+ listen (2.7.1)
111
114
  celluloid (>= 0.15.2)
115
+ celluloid-io (>= 0.15.0)
112
116
  rb-fsevent (>= 0.9.3)
113
117
  rb-inotify (>= 0.9)
114
118
  log4r (1.1.10)
@@ -121,6 +125,7 @@ GEM
121
125
  net-ssh (>= 2.6.5)
122
126
  net-ssh (2.7.0)
123
127
  netrc (0.7.7)
128
+ nio4r (1.0.0)
124
129
  nokogiri (1.6.1)
125
130
  mini_portile (~> 0.5.0)
126
131
  oauth2 (0.9.3)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.16
1
+ 0.4.17
@@ -4,11 +4,9 @@
4
4
  # Install Git.
5
5
  apt-get -y install git || exit 10
6
6
 
7
- echo "Hello $USER"
8
-
9
7
  # Make sure it is easy to communicate with repo hosts
10
- mkdir -p ~/.ssh || exit 11
11
- touch ~/.ssh/known_hosts || exit 12
8
+ mkdir -p "/root/.ssh" || exit 11
9
+ touch "/root/.ssh/known_hosts" || exit 12
12
10
 
13
11
  ssh-keygen -R github.com 2>&1 || exit 13 # No duplicates
14
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts || exit 14
12
+ ssh-keyscan -H github.com >> "/root/.ssh/known_hosts" || exit 14
@@ -2,12 +2,12 @@
2
2
  #-------------------------------------------------------------------------------
3
3
 
4
4
  # Install Ruby.
5
- add-apt-repository ppa:brightbox/ruby-ng-experimental 2>&1 || exit 51
5
+ add-apt-repository -y ppa:brightbox/ruby-ng-experimental 2>&1 || exit 51
6
6
  apt-get update || exit 52
7
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
+ apt-get -y install ruby2.0 ruby2.0-dev || exit 53
9
+ update-alternatives --set ruby /usr/bin/ruby2.0 || exit 54
10
+ update-alternatives --set gem /usr/bin/gem2.0 || exit 55
11
11
 
12
12
  # Set Gem options
13
13
  ( cat <<'EOP'
@@ -13,7 +13,7 @@ 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
16
- apt-get -y install puppet || exit 64
16
+ apt-get -y install puppet=3.4.3-1puppetlabs1 || exit 64
17
17
 
18
18
  # Set up Hiera configuration
19
19
  mkdir -p /var/corl/config || exit 65
data/corl.gemspec CHANGED
@@ -2,16 +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
+ # stub: corl 0.4.17 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "corl"
9
- s.version = "0.4.16"
9
+ s.version = "0.4.17"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Adrian Webb"]
14
- s.date = "2014-04-08"
14
+ s.date = "2014-04-14"
15
15
  s.description = "Framework that provides a simple foundation for growing organically in the cloud"
16
16
  s.email = "adrian.webb@coralnexus.com"
17
17
  s.executables = ["corl"]
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
58
58
  "lib/CORL/action/lookup.rb",
59
59
  "lib/CORL/action/machines.rb",
60
60
  "lib/CORL/action/provision.rb",
61
+ "lib/CORL/action/reboot.rb",
61
62
  "lib/CORL/action/regions.rb",
62
63
  "lib/CORL/action/seed.rb",
63
64
  "lib/CORL/action/spawn.rb",
@@ -83,6 +84,7 @@ Gem::Specification.new do |s|
83
84
  "lib/core/mixin/action/keypair.rb",
84
85
  "lib/core/mixin/lookup.rb",
85
86
  "lib/core/mixin/macro/network_settings.rb",
87
+ "lib/core/mod/facter_loader.rb",
86
88
  "lib/core/mod/fog_aws_server.rb",
87
89
  "lib/core/mod/fog_rackspace_server.rb",
88
90
  "lib/core/mod/hiera_backend.rb",
@@ -98,6 +100,10 @@ Gem::Specification.new do |s|
98
100
  "lib/core/util/puppet/resource.rb",
99
101
  "lib/core/util/puppet/resource_group.rb",
100
102
  "lib/core/vagrant/Vagrantfile",
103
+ "lib/core/vagrant/action.rb",
104
+ "lib/core/vagrant/actions/create_shares.rb",
105
+ "lib/core/vagrant/actions/delete_cache.rb",
106
+ "lib/core/vagrant/actions/init_keys.rb",
101
107
  "lib/core/vagrant/commands/launcher.rb",
102
108
  "lib/core/vagrant/config.rb",
103
109
  "lib/core/vagrant/plugins.rb",
@@ -0,0 +1,59 @@
1
+
2
+ module CORL
3
+ module Action
4
+ class Reboot < Plugin::CloudAction
5
+
6
+ #-----------------------------------------------------------------------------
7
+ # Settings
8
+
9
+ def configure
10
+ super do
11
+ register :reboot_nodes, :array, nil do |values|
12
+ if values.nil?
13
+ warn('corl.actions.reboot.errors.reboot_nodes_empty')
14
+ next false
15
+ end
16
+
17
+ node_plugins = CORL.loaded_plugins(:node)
18
+ success = true
19
+
20
+ values.each do |value|
21
+ if info = CORL.plugin_class(:node).translate_reference(value)
22
+ if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
23
+ warn('corl.actions.reboot.errors.reboot_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
24
+ success = false
25
+ end
26
+ end
27
+ end
28
+ success
29
+ end
30
+ end
31
+ end
32
+
33
+ #---
34
+
35
+ def ignore
36
+ [ :nodes ]
37
+ end
38
+
39
+ def arguments
40
+ [ :reboot_nodes ]
41
+ end
42
+
43
+ #-----------------------------------------------------------------------------
44
+ # Operations
45
+
46
+ def execute
47
+ super do |local_node, network|
48
+ ensure_network(network) do
49
+ batch_success = network.batch(settings[:reboot_nodes], settings[:node_provider], settings[:parallel]) do |node|
50
+ info('corl.actions.reboot.start', { :provider => node.plugin_provider, :name => node.plugin_name })
51
+ node.reload
52
+ end
53
+ myself.status = code.batch_error unless batch_success
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -76,7 +76,8 @@ class File < CORL.plugin_class(:configuration)
76
76
 
77
77
  generate_routes.call(config_name, parse_properties)
78
78
  properties.import(parse_properties)
79
- end
79
+ end
80
+ CORL.remove_plugin(parser) if parser
80
81
  end
81
82
  end
82
83
  end
@@ -189,6 +190,7 @@ class File < CORL.plugin_class(:configuration)
189
190
  else
190
191
  success = false
191
192
  end
193
+ CORL.remove_plugin(renderer)
192
194
  else
193
195
  success = false
194
196
  end
@@ -104,16 +104,18 @@ class Vagrant < CORL.plugin_class(:machine)
104
104
  def download(remote_path, local_path, options = {})
105
105
  super do |config, success|
106
106
  begin
107
- server.communicate.tap do |comm|
108
- comm.download(remote_path, local_path)
107
+ if init_ssh_session
108
+ Util::SSH.download(node.public_ip, node.user, remote_path, local_path, config.export) do |name, received, total|
109
+ yield(name, received, total) if block_given?
110
+ end
111
+ true
112
+ else
113
+ false
109
114
  end
110
- success = true
111
-
112
115
  rescue Exception => error
113
116
  ui.error(error.message)
114
- success = false
117
+ false
115
118
  end
116
- success
117
119
  end
118
120
  end
119
121
 
@@ -122,16 +124,18 @@ class Vagrant < CORL.plugin_class(:machine)
122
124
  def upload(local_path, remote_path, options = {})
123
125
  super do |config, success|
124
126
  begin
125
- server.communicate.tap do |comm|
126
- comm.upload(local_path, remote_path)
127
+ if init_ssh_session
128
+ Util::SSH.upload(node.public_ip, node.user, local_path, remote_path, config.export) do |name, sent, total|
129
+ yield(name, sent, total) if block_given?
130
+ end
131
+ true
132
+ else
133
+ false
127
134
  end
128
- success = true
129
-
130
135
  rescue Exception => error
131
136
  ui.error(error.message)
132
- success = false
137
+ false
133
138
  end
134
- success
135
139
  end
136
140
  end
137
141
 
@@ -139,41 +143,22 @@ class Vagrant < CORL.plugin_class(:machine)
139
143
 
140
144
  def exec(commands, options = {})
141
145
  super do |config, results|
142
- codes :vagrant_exec_failed
143
-
144
- begin
145
- server.communicate.tap do |comm|
146
- commands.each do |command|
147
- as_admin = command.match(/^sudo\s+/) ? true : false
148
- result = Util::Shell::Result.new(command.gsub(/^sudo\s+/, '').strip)
149
-
150
- result.status = comm.execute(result.command, { :sudo => as_admin }) do |type, data|
151
- case type
152
- when :stdout
153
- result.append_output(data)
154
- yield(:output, result.command, data) if block_given?
155
- when :stderr
156
- result.append_errors(data)
157
- yield(:error, result.command, data) if block_given?
158
- end
159
- end
160
- results << result
161
- end
146
+ if init_ssh_session
147
+ results = Util::SSH.exec(node.public_ip, node.user, commands) do |type, command, data|
148
+ yield(type, command, data) if block_given?
162
149
  end
163
-
164
- rescue Exception => error
165
- ui.error(error.message)
166
- results << Util::Shell::Result.new(command, code.vagrant_exec_failed)
167
- end
150
+ else
151
+ results = nil
152
+ end
168
153
  results
169
- end
154
+ end
170
155
  end
171
156
 
172
157
  #---
173
158
 
174
159
  def terminal(user, options = {})
175
160
  super do |config|
176
- run(:ssh, { :ssh_opts => config.export })
161
+ Util::SSH.terminal(node.public_ip, user, config.export)
177
162
  end
178
163
  end
179
164
 
@@ -181,7 +166,8 @@ class Vagrant < CORL.plugin_class(:machine)
181
166
 
182
167
  def reload(options = {})
183
168
  super do |config|
184
- run(:reload, config)
169
+ success = run(:reload, config)
170
+ success = init_ssh_session(true, config.get(:tries, 5), config.get(:sleep_time, 5)) if success
185
171
  end
186
172
  end
187
173
 
@@ -200,6 +186,7 @@ class Vagrant < CORL.plugin_class(:machine)
200
186
  FileUtils.rm_f(box_path)
201
187
 
202
188
  begin
189
+ close_ssh_session
203
190
  success = run(:package, config.defaults({ 'package.output' => box_path }), false)
204
191
 
205
192
  node.set_cache_setting(:box, box_name)
@@ -277,6 +264,7 @@ class Vagrant < CORL.plugin_class(:machine)
277
264
  Util::Disk.delete(box_path)
278
265
  end
279
266
  end
267
+ close_ssh_session if success
280
268
  success
281
269
  end
282
270
  end
@@ -353,6 +341,34 @@ class Vagrant < CORL.plugin_class(:machine)
353
341
  success
354
342
  end
355
343
  protected :run
344
+
345
+ #---
346
+
347
+ def init_ssh_session(reset = false, tries = 5, sleep_secs = 5)
348
+ success = true
349
+
350
+ begin
351
+ Util::SSH.session(node.public_ip, node.user, node.ssh_port, node.private_key, reset)
352
+
353
+ rescue Exception => error
354
+ if tries > 1
355
+ sleep(sleep_secs)
356
+
357
+ tries -= 1
358
+ reset = true
359
+ retry
360
+ else
361
+ success = false
362
+ end
363
+ end
364
+ success
365
+ end
366
+
367
+ #---
368
+
369
+ def close_ssh_session
370
+ Util::SSH.close_session(node.public_ip, node.user)
371
+ end
356
372
  end
357
373
  end
358
374
  end
@@ -86,6 +86,7 @@ class Vagrant < CORL.plugin_class(:node)
86
86
  super do |op, config|
87
87
  if op == :config
88
88
  config.import(exec_options(:create))
89
+ config[:provision_enabled] = false
89
90
  end
90
91
  end
91
92
  end
@@ -135,6 +136,7 @@ class Vagrant < CORL.plugin_class(:node)
135
136
  super do |op, config|
136
137
  if op == :config
137
138
  config.import(exec_options(:start))
139
+ config[:provision_enabled] = false
138
140
  end
139
141
  end
140
142
  end
@@ -145,6 +147,7 @@ class Vagrant < CORL.plugin_class(:node)
145
147
  super do |op, config|
146
148
  if op == :config
147
149
  config.import(exec_options(:reload))
150
+ config[:provision_enabled] = false
148
151
  end
149
152
  end
150
153
  end
@@ -1,4 +1,3 @@
1
-
2
1
  module CORL
3
2
  module Provisioner
4
3
  class Puppetnode < CORL.plugin_class(:provisioner)
@@ -17,26 +16,26 @@ class Puppetnode < CORL.plugin_class(:provisioner)
17
16
  Puppet::Util::Log.newdesttype id do
18
17
  def handle(msg)
19
18
  levels = {
20
- :emerg => { :name => 'emergency', :send => :error },
21
- :alert => { :name => 'alert', :send => :error },
22
- :crit => { :name => 'critical', :send => :error },
23
- :err => { :name => 'error', :send => :error },
19
+ :emerg => { :name => 'emergency', :send => :error },
20
+ :alert => { :name => 'alert', :send => :error },
21
+ :crit => { :name => 'critical', :send => :error },
22
+ :err => { :name => 'error', :send => :error },
24
23
  :warning => { :name => 'warning', :send => :warn },
25
- :notice => { :name => 'notice', :send => :success },
26
- :info => { :name => 'info', :send => :info },
27
- :debug => { :name => 'debug', :send => :info }
24
+ :notice => { :name => 'notice', :send => :success },
25
+ :info => { :name => 'info', :send => :info },
26
+ :debug => { :name => 'debug', :send => :info }
28
27
  }
29
- str = msg.respond_to?(:multiline) ? msg.multiline : msg.to_s
30
- str = msg.source == "Puppet" ? str : "#{CORL.blue(msg.source)}: #{str}"
28
+ str = msg.respond_to?(:multiline) ? msg.multiline : msg.to_s
29
+ str = msg.source == "Puppet" ? str : "#{CORL.blue(msg.source)}: #{str}"
31
30
  level = levels[msg.level]
32
31
 
33
- CORL.ui_group("puppetnode::#{name}(#{CORL.yellow(level[:name])})", :cyan) do |ui|
32
+ CORL.ui_group("puppetnode::#{name}(#{CORL.yellow(level[:name])})", :cyan) do |ui|
34
33
  ui.send(level[:send], str)
35
34
  end
36
35
  end
37
36
  end
38
37
  end
39
- end
38
+ end
40
39
  end
41
40
 
42
41
  #---
@@ -73,7 +72,7 @@ class Puppetnode < CORL.plugin_class(:provisioner)
73
72
 
74
73
  Puppet[:default_file_terminus] = :file_server
75
74
 
76
- node = get_node
75
+ node = get_node
77
76
  Puppet[:node_name_value] = id.to_s
78
77
 
79
78
  unless profiles.empty?
@@ -87,9 +86,9 @@ class Puppetnode < CORL.plugin_class(:provisioner)
87
86
  if manifest.match(/^packages\/.*/)
88
87
  manifest = File.join(build_directory, locations[:build], manifest)
89
88
  else
90
- manifest = File.join(network.directory, directory, manifest)
91
- end
92
- Puppet[:manifest] = manifest
89
+ manifest = File.join(network.directory, directory, manifest)
90
+ end
91
+ Puppet[:manifest] = manifest
93
92
  end
94
93
 
95
94
  @compiler = Puppet::Parser::Compiler.new(node)
@@ -102,7 +101,7 @@ class Puppetnode < CORL.plugin_class(:provisioner)
102
101
 
103
102
  def get_node
104
103
  node_id = id.to_s
105
- node = Puppet::Node.indirection.find(node_id)
104
+ node = Puppet::Node.indirection.find(node_id)
106
105
 
107
106
  if facts = Puppet::Node::Facts.indirection.find(node_id)
108
107
  facts.name = node_id
@@ -123,8 +122,8 @@ class Puppetnode < CORL.plugin_class(:provisioner)
123
122
  locations[:module] = {}
124
123
 
125
124
  init_profile = lambda do |package_name, profile_name, profile_info|
126
- package_id = id(package_name)
127
- base_directory = File.join(locations[:build], 'modules', package_id.to_s, profile_name.to_s)
125
+ package_id = id(package_name)
126
+ base_directory = File.join(locations[:build], 'modules', package_id.to_s, profile_name.to_s)
128
127
  profile_success = true
129
128
 
130
129
  ui.info("Building CORL profile #{blue(profile_name)} modules into #{green(base_directory)}")
@@ -139,20 +138,20 @@ class Puppetnode < CORL.plugin_class(:provisioner)
139
138
 
140
139
  module_project = CORL.project(extended_config(:puppet_module, {
141
140
  :directory => full_module_directory,
142
- :url => module_reference,
143
- :create => File.directory?(full_module_directory) ? false : true,
144
- :pull => true
141
+ :url => module_reference,
142
+ :create => File.directory?(full_module_directory) ? false : true,
143
+ :pull => true
145
144
  }))
146
145
  unless module_project
147
146
  ui.warn("Puppet module #{cyan(module_name)} failed to initialize")
148
147
  profile_success = false
149
148
  break
150
- end
149
+ end
151
150
  end
152
151
  locations[:module][profile_id(package_name, profile_name)] = base_directory if profile_success
153
152
  profile_success
154
153
  end
155
- end
154
+ end
156
155
 
157
156
  hash(package_info.get([ :provisioners, plugin_provider ])).each do |package_name, info|
158
157
  if info.has_key?(:profiles)
@@ -167,35 +166,35 @@ class Puppetnode < CORL.plugin_class(:provisioner)
167
166
  profiles.each do |profile_name, profile_info|
168
167
  unless init_profile.call(plugin_name, profile_name, profile_info)
169
168
  success = false
170
- break
169
+ break
171
170
  end
172
- end
171
+ end
173
172
  success
174
- end
173
+ end
175
174
  end
176
175
 
177
176
  #---
178
177
 
179
178
  def lookup(property, default = nil, options = {})
180
- Util::Puppet.lookup(property, default, Config.ensure(options).defaults({
181
- :provisioner => :puppetnode,
182
- :puppet_scope => scope
179
+ Util::Puppet.lookup(property, default, Config.ensure(options).defaults({
180
+ :provisioner => :puppetnode,
181
+ :puppet_scope => scope
183
182
  }))
184
183
  end
185
184
 
186
185
  #--
187
186
 
188
187
  def import(files, options = {})
189
- Util::Puppet.import(files, Config.ensure(options).defaults({
190
- :puppet_scope => scope,
191
- :puppet_import_base => network.directory
188
+ Util::Puppet.import(files, Config.ensure(options).defaults({
189
+ :puppet_scope => scope,
190
+ :puppet_import_base => network.directory
192
191
  }))
193
192
  end
194
193
 
195
194
  #---
196
195
 
197
196
  def add_search_path(type, resource_name)
198
- Config.set_options([ :all, type ], { :search => [ resource_name.to_s ] })
197
+ Config.set_options([ :all, type ], { :search => [ resource_name.to_s ] })
199
198
  end
200
199
 
201
200
  #---
@@ -203,20 +202,20 @@ class Puppetnode < CORL.plugin_class(:provisioner)
203
202
  def provision(profiles, options = {})
204
203
  super do |config|
205
204
  locations = build_locations
206
- success = true
205
+ success = true
207
206
 
208
207
  include_location = lambda do |type, parameters = {}, add_search_path = false|
209
208
  classes = {}
210
209
 
211
210
  locations[:package].each do |name, package_directory|
212
- type_gateway = File.join(build_directory, package_directory, "#{type}.pp")
211
+ type_gateway = File.join(build_directory, package_directory, "#{type}.pp")
213
212
  resource_name = concatenate([ name, type ])
214
213
 
215
214
  add_search_path(type, resource_name) if add_search_path
216
215
 
217
216
  if File.exists?(type_gateway)
218
217
  import(type_gateway)
219
- classes[resource_name] = parameters
218
+ classes[resource_name] = parameters
220
219
  end
221
220
 
222
221
  type_directory = File.join(build_directory, package_directory, type.to_s)
@@ -224,17 +223,17 @@ class Puppetnode < CORL.plugin_class(:provisioner)
224
223
  resource_name = concatenate([ name, type, File.basename(file).gsub('.pp', '') ])
225
224
  import(file)
226
225
  classes[resource_name] = parameters
227
- end
226
+ end
228
227
  end
229
228
 
230
- type_gateway = File.join(directory, "#{type}.pp")
229
+ type_gateway = File.join(directory, "#{type}.pp")
231
230
  resource_name = concatenate([ plugin_name, type ])
232
231
 
233
232
  add_search_path(type, resource_name) if add_search_path
234
233
 
235
234
  if File.exists?(type_gateway)
236
235
  import(type_gateway)
237
- classes[resource_name] = parameters
236
+ classes[resource_name] = parameters
238
237
  end
239
238
 
240
239
  type_directory = File.join(directory, type.to_s)
@@ -250,11 +249,11 @@ class Puppetnode < CORL.plugin_class(:provisioner)
250
249
  end
251
250
 
252
251
  @@puppet_lock.synchronize do
253
- begin
252
+ begin
254
253
  ui.info("Starting catalog generation")
255
254
 
256
- start_time = Time.now
257
- node = init_puppet(profiles)
255
+ start_time = Time.now
256
+ node = init_puppet(profiles)
258
257
 
259
258
  # Include defaults
260
259
  classes = include_location.call(:default, {}, true)
@@ -289,7 +288,7 @@ class Puppetnode < CORL.plugin_class(:provisioner)
289
288
  raise error
290
289
  Puppet.log_exception(error)
291
290
  end
292
- end
291
+ end
293
292
  success
294
293
  end
295
294
  end