chef-vpc-toolkit 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * Thu Apr 16 2011 Dan Prince <dan.prince@rackspace.com> - 2.5.1
2
+ - Updates to support Ruby 1.9.2.
3
+
1
4
  * Thu Apr 14 2011 Dan Prince <dan.prince@rackspace.com> - 2.5.0
2
5
  - Make /root/cookbook-repos on the Chef server if it doesn't exist.
3
6
  - Add cache_file option to the VPC Client class.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.5.1
@@ -19,6 +19,16 @@ def self.load_configs
19
19
 
20
20
  end
21
21
 
22
+ def self.get_cookbook_repos(options)
23
+ cookbook_repos_config=options["chef_cookbook_repos"]
24
+ return "" if cookbook_repos_config.nil?
25
+ if cookbook_repos_config.respond_to?(:inject) then
26
+ return options["chef_cookbook_repos"].inject { |sum, c| sum + " " + c }
27
+ else
28
+ return cookbook_repos_config.to_s
29
+ end
30
+ end
31
+
22
32
  # validate the chef.json config file by parsing it
23
33
  def self.validate_json(options)
24
34
 
@@ -65,10 +75,7 @@ json.each_pair do |node_name, node_json|
65
75
  knife_add_nodes_script+="knife_add_node '#{node_name}' '#{run_list}' '#{attributes}'\n"
66
76
  end
67
77
 
68
- cookbook_urls=""
69
- if options["chef_cookbook_repos"] then
70
- cookbook_urls=options["chef_cookbook_repos"].inject { |sum, c| sum + " " + c }
71
- end
78
+ cookbook_urls=self.get_cookbook_repos(options)
72
79
  os_type=machine_os_types[options['chef_server_name']]
73
80
 
74
81
  data=%x{
@@ -254,10 +261,7 @@ def self.rsync_cookbook_repos(options, local_dir="#{CHEF_VPC_PROJECT}/cookbook-r
254
261
  puts "OK"
255
262
  end
256
263
 
257
- cookbook_urls=""
258
- if options["chef_cookbook_repos"] then
259
- cookbook_urls=options["chef_cookbook_repos"].inject { |sum, c| sum + " " + c }
260
- end
264
+ cookbook_urls=self.get_cookbook_repos(options)
261
265
 
262
266
  data=%x{
263
267
  ssh -o "StrictHostKeyChecking no" root@#{options['ssh_gateway_ip']} bash <<-"EOF_SSH"
@@ -25,10 +25,18 @@ class Client
25
25
  @id=options[:id].to_i
26
26
  @name=options[:name]
27
27
  @description=options[:description]
28
+ if options[:status]
29
+ @status=options[:status]
30
+ else
31
+ @status = "Pending"
32
+ end
28
33
  @status=options[:status] or @status = "Pending"
29
34
  @server_group_id=options[:server_group_id]
30
- @cache_file=options[:cache_file] or options[:server_group_id]
31
-
35
+ if options[:cache_file] then
36
+ @cache_file=options[:cache_file]
37
+ else
38
+ @cache_file=options[:server_group_id]
39
+ end
32
40
  @vpn_network_interfaces=[]
33
41
  end
34
42
 
@@ -52,17 +60,16 @@ class Client
52
60
  end
53
61
 
54
62
  def self.from_xml(xml)
55
-
56
63
  client=nil
57
64
  dom = REXML::Document.new(xml)
58
- REXML::XPath.each(dom, "/client") do |client|
65
+ REXML::XPath.each(dom, "/client") do |cxml|
59
66
 
60
67
  client=Client.new(
61
- :id => XMLUtil.element_text(client,"id").to_i,
62
- :name => XMLUtil.element_text(client, "name"),
63
- :description => XMLUtil.element_text(client,"description"),
64
- :status => XMLUtil.element_text(client,"status"),
65
- :server_group_id => XMLUtil.element_text(client, "server-group-id").to_i
68
+ :id => XMLUtil.element_text(cxml,"id").to_i,
69
+ :name => XMLUtil.element_text(cxml, "name"),
70
+ :description => XMLUtil.element_text(cxml,"description"),
71
+ :status => XMLUtil.element_text(cxml,"status"),
72
+ :server_group_id => XMLUtil.element_text(cxml, "server-group-id").to_i
66
73
  )
67
74
  REXML::XPath.each(dom, "//vpn-network-interface") do |vni|
68
75
  vni = VpnNetworkInterface.new(
@@ -75,10 +82,8 @@ class Client
75
82
  )
76
83
  client.vpn_network_interfaces << vni
77
84
  end
78
- end
79
-
85
+ end
80
86
  client
81
-
82
87
  end
83
88
 
84
89
  def to_xml
@@ -222,7 +222,7 @@ namespace :chef do
222
222
  timeout=ENV['CHEF_TIMEOUT']
223
223
  group=ServerGroup.fetch(:source => "cache")
224
224
  if server_list.nil? or server_list.empty?
225
- server_list=group.server_names.collect{|x| x+" "}.to_s
225
+ server_list=group.server_names.collect{|x| x+" "}.join.to_s
226
226
  end
227
227
  if timeout.nil? or timeout.empty?
228
228
  timeout=600
@@ -341,7 +341,7 @@ namespace :vpn do
341
341
  vpn_client_name=configs['vpn_client_name']
342
342
  end
343
343
 
344
- client=Client.create(group, vpn_client_name)
344
+ client=Client.create(group, vpn_client_name, true)
345
345
  puts "Client ID #{client.id} created."
346
346
 
347
347
  end
data/test/client_test.rb CHANGED
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  module ChefVPCToolkit
4
5
  module CloudServersVPC
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  require 'fileutils'
4
5
  require 'tempfile'
data/test/server_test.rb CHANGED
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  module ChefVPCToolkit
4
5
  module CloudServersVPC
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  require 'tempfile'
4
5
 
data/test/test_helper.rb CHANGED
@@ -3,9 +3,8 @@ require 'rubygems'
3
3
  require 'mocha'
4
4
  CHEF_VPC_PROJECT = "#{File.dirname(__FILE__)}" unless defined?(CHEF_VPC_PROJECT)
5
5
 
6
- Dir[File.join(File.dirname(__FILE__), '/../lib', '*.rb')].each do |lib|
7
- require(lib)
8
- end
6
+ $:.unshift File.dirname(__FILE__) + '/../lib'
7
+ require 'chef-vpc-toolkit'
9
8
 
10
9
  require 'tempfile'
11
10
  require 'fileutils'
data/test/util_test.rb CHANGED
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  module ChefVPCToolkit
4
5
 
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test_helper'
2
3
 
3
4
  require 'tempfile'
4
5
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-vpc-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 5
9
- - 0
10
- version: 2.5.0
9
+ - 1
10
+ version: 2.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Prince
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-14 00:00:00 -04:00
18
+ date: 2011-04-16 00:00:00 -04:00
19
19
  default_executable: chef-vpc-toolkit
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency