knife-solo 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@ require 'chef/knife'
2
2
  require 'knife-solo/ssh_command'
3
3
  require 'knife-solo/kitchen_command'
4
4
  require 'knife-solo/bootstraps'
5
+ require 'knife-solo/knife_solo_error'
5
6
 
6
7
  class Chef
7
8
  class Knife
@@ -11,6 +12,10 @@ class Chef
11
12
  include KnifeSolo::SshCommand
12
13
  include KnifeSolo::KitchenCommand
13
14
 
15
+ class WrongPrepareError < KnifeSolo::KnifeSoloError
16
+ alias :message :to_s
17
+ end
18
+
14
19
  banner "knife prepare [user@]hostname (options)"
15
20
 
16
21
  option :omnibus_version,
@@ -18,6 +23,7 @@ class Chef
18
23
  :description => "The version of Omnibus to install"
19
24
 
20
25
  def run
26
+ validate_params!
21
27
  super
22
28
  bootstrap.bootstrap!
23
29
  generate_node_config
@@ -38,6 +44,12 @@ class Chef
38
44
  def operating_system
39
45
  @operating_system ||= run_command('uname -s').stdout.strip
40
46
  end
47
+
48
+ def validate_params!
49
+ unless @name_args.first =~ /\A.+\@.+\z/
50
+ raise WrongPrepareError.new "need to pass a [user@]hostname as the first argument"
51
+ end
52
+ end
41
53
  end
42
54
  end
43
55
  end
@@ -14,7 +14,7 @@ module KnifeSolo::Bootstraps
14
14
  end
15
15
 
16
16
  def http_client_get_url(url)
17
- "wget #{url}"
17
+ "curl -LO #{url}"
18
18
  end
19
19
 
20
20
  def zypper_gem_install
@@ -91,6 +91,10 @@ module KnifeSolo::Bootstraps
91
91
  {:type => "omnibus", :version => "RHEL5"}
92
92
  when %r{Red Hat Enterprise.*? 6}
93
93
  {:type => "omnibus", :version => "RHEL6"}
94
+ when %r{Fedora release.*? 15}
95
+ {:type => "omnibus", :version => "FC15"}
96
+ when %r{Fedora release.*? 16}
97
+ {:type => "omnibus", :version => "FC16"}
94
98
  when %r{Scientific Linux.*? 5}
95
99
  {:type => "omnibus", :version => "RHEL5"}
96
100
  when %r{Scientific Linux.*? 6}
@@ -1,5 +1,5 @@
1
1
  module KnifeSolo
2
2
  def self.version
3
- '0.0.11'
3
+ '0.0.12'
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
+ require 'knife-solo/knife_solo_error'
2
+
1
3
  module KnifeSolo
2
4
  module KitchenCommand
3
- class OutOfKitchenError < StandardError
5
+ class OutOfKitchenError < KnifeSoloError
4
6
  def message
5
7
  "This command must be run inside a Chef solo kitchen."
6
8
  end
@@ -23,7 +25,11 @@ module KnifeSolo
23
25
  end
24
26
 
25
27
  def required_files_present?
26
- KitchenCommand.all_requirements.inject(true) { |m, f| m && File.exists?(f) }
28
+ KitchenCommand.all_requirements.inject(true) do |m, f|
29
+ check = File.exists?(f)
30
+ Chef::Log.warn "#{f} is a required file/directory" unless check
31
+ m && check
32
+ end
27
33
  end
28
34
  end
29
35
  end
@@ -0,0 +1,3 @@
1
+ module KnifeSolo
2
+ class KnifeSoloError < StandardError; end
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-solo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -114,6 +114,7 @@ files:
114
114
  - lib/knife-solo/bootstraps.rb
115
115
  - lib/knife-solo/info.rb
116
116
  - lib/knife-solo/kitchen_command.rb
117
+ - lib/knife-solo/knife_solo_error.rb
117
118
  - lib/knife-solo/ssh_command.rb
118
119
  - lib/knife-solo/tools.rb
119
120
  - lib/knife-solo.rb
@@ -131,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  segments:
133
134
  - 0
134
- hash: -4055185627370622040
135
+ hash: -4402118030036500865
135
136
  required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  none: false
137
138
  requirements:
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  segments:
142
143
  - 0
143
- hash: -4055185627370622040
144
+ hash: -4402118030036500865
144
145
  requirements: []
145
146
  rubyforge_project: nowarning
146
147
  rubygems_version: 1.8.24