chef-solo-wrapper 0.0.15 → 0.0.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.
data/bin/cs CHANGED
@@ -16,14 +16,14 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- CHEF_SOLO_WRAPPER_VERSION = '0.0.15'
20
- COOKBOOKS_SRC_DEST = '/usr/src/chef-cookbooks'
21
-
22
19
  require 'rubygems'
23
20
  require 'trollop'
24
21
  require 'json'
25
22
  require 'yaml'
26
23
 
24
+ CHEF_SOLO_WRAPPER_VERSION = '0.0.16'
25
+ COOKBOOKS_SRC_DEST = '/usr/src/chef-cookbooks'
26
+
27
27
  opts = Trollop::options do
28
28
  version 'chef-solo-wrapper '+CHEF_SOLO_WRAPPER_VERSION+' (c) 2011 Chris Fordham'
29
29
  banner <<-EOS
@@ -73,6 +73,13 @@ else
73
73
  DEBUG = false
74
74
  end
75
75
 
76
+ solo = false
77
+ server = false
78
+ rs_home = File.expand_path('~')+'/.rightscale'
79
+ env_file = rs_home+'/chef_env.sh'
80
+ json_file = '/etc/chef/node.json'
81
+ solo_file = '/etc/chef/solo.rb'
82
+
76
83
  require File.join(File.dirname(__FILE__), '../lib/chef_solo_wrapper.rb')
77
84
  require File.join(File.dirname(__FILE__), "../lib/easy_logger.rb")
78
85
  require File.join(File.dirname(__FILE__), '../lib/config_helper.rb')
@@ -83,14 +90,6 @@ config = ConfigHelper.new(SETUP_DEFAULTS, DEBUG, log_level)
83
90
 
84
91
  logger.log "cli_options: #{opts.to_json}", 'verbose'
85
92
  puts "options: #{opts.to_json}" if opts[:help]
86
-
87
- solo = false
88
- server = false
89
- rs_home = File.expand_path('~')+'/.rightscale'
90
- env_file = rs_home+'/chef_env.sh'
91
-
92
- json_file = '/etc/chef/node.json'
93
- solo_file = '/etc/chef/solo.rb'
94
93
 
95
94
  # env/inputs
96
95
  if opts[:env]
@@ -138,11 +137,26 @@ if opts[:install]
138
137
  logger.log install, 'verbose'
139
138
  else
140
139
  logger.log install, 'error'
141
- raise "Failed to fetch the git cookbook from GitHub.!"
140
+ raise "Failed to fetch the git cookbook from GitHub!"
142
141
  end
143
142
  File.open('/etc/chef/install_git.json', "w") {|f| f.write '{ "run_list": [ "recipe[git::default]" ] }' }
144
143
  File.open('/etc/chef/install_git_solo.rb', "w") {|f| f.write 'file_cache_path "/var/chef-solo"'+"\n"+'cookbook_path [ "/usr/src/chef-cookbooks" ]'+"\n"'json_attribs "/etc/chef/node.json"'+"\n"}
145
144
  system("chef-solo -c /etc/chef/install_git_solo.rb -j /etc/chef/install_git.json")
145
+ when 'java'
146
+ # requires chef
147
+ system('rm -Rf /usr/src/java*; rm -Rf /usr/src/chef-cookbooks/java*')
148
+ logger.log "[wget] Fetching java cookbook from GitHub..."
149
+ fetch_cmd = "mkdir -p /usr/src/chef-cookbooks && wget --no-check-certificate https://github.com/opscode-cookbooks/java/tarball/master -O /usr/src/java_cookbook.tar 2>&1 && cd /usr/src && tar zxvf /usr/src/java_cookbook.tar && mv -v /usr/src/opscode-cookbooks-java-* /usr/src/chef-cookbooks/java"
150
+ install = "[java_install] " + `#{fetch_cmd}`; result=$?.success?
151
+ if result
152
+ logger.log install, 'verbose'
153
+ else
154
+ logger.log install, 'error'
155
+ raise "Failed to fetch the java cookbook from GitHub!"
156
+ end
157
+ File.open(json_file, "w") {|f| f.write '{ "run_list": [ "recipe[java::default]" ] }' }
158
+ File.open(solo_file, "w") {|f| f.write 'file_cache_path "/var/chef-solo"'+"\n"+'cookbook_path [ "/usr/src/chef-cookbooks" ]'+"\n"'json_attribs "/etc/chef/node.json"'+"\n"}
159
+ system("chef-solo -c #{solo_file} -j #{json_file}")
146
160
  end
147
161
  exit
148
162
  end
@@ -5,4 +5,14 @@ class ChefSoloWrapper
5
5
  puts "[#{`date`.strip}] Log level: #{facility_log_level.upcase}"
6
6
  end
7
7
 
8
+ def run_wrapper
9
+
10
+
11
+ end
12
+
13
+ def download_and_run_cookbook_recipe
14
+
15
+
16
+ end
17
+
8
18
  end
@@ -61,6 +61,7 @@ class ConfigHelper < ChefSoloWrapper
61
61
  system('echo "deb http://apt.opscode.com/ $(lsb_release -cs)-0.10 main" > /etc/apt/sources.list.d/opscode.list')
62
62
  system("sudo apt-get -y update")
63
63
  system("sudo apt-get -y upgrade")
64
+ system("sudo apt-get -y install libxml2 libxml2-dev libxslt-dev")
64
65
  system("sudo apt-get -y install chef")
65
66
  else
66
67
  @l.log "[dpkg] Chef already installed, skipping."
@@ -80,6 +81,10 @@ class ConfigHelper < ChefSoloWrapper
80
81
  @l.log 'Ubuntu detected; installing from opscode apt.', 'debug'
81
82
  install_chef_opscode_apt
82
83
  return
84
+ when 'CentOS'
85
+ puts 'Needs testing.'
86
+ # on centos/el/redhat
87
+ #system("sudo yum -y install libxml2 libxml2-devel libxslt-devel")
83
88
  else
84
89
  puts " DEBUG: == RubyGems Sources ==\n#{`gem sources`}\n==\n" if @debug
85
90
  @l.log 'Installing Chef RubyGem...'
@@ -153,7 +158,7 @@ class ConfigHelper < ChefSoloWrapper
153
158
  end
154
159
 
155
160
  def install_rest_connection(auto=false)
156
- @l.log 'Setting up rest_connection.'
161
+ @l.log 'Setting up RestConnection.'
157
162
  begin
158
163
  if auto or @setup_defaults
159
164
  install_rc = 'y'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-solo-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 15
10
- version: 0.0.15
9
+ - 16
10
+ version: 0.0.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Fordham