knife-server 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
4
5
  - 1.9.2
5
6
  - ruby-head
6
7
  - 1.8.7
7
- - ree
8
8
 
9
9
  env:
10
10
  - "CHEF_VERSION=11.4.0"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 1.0.1 / 2013-04-11
2
+
3
+ ### Bug fixes
4
+
5
+ * Pull request [#29][]: Fix README typo in ssh password argument. ([@ranjib][])
6
+ * Pull request [#34][]: Fix AMQP_PASSWORD propagation. ([@erikh][])
7
+
8
+ ### Improvement
9
+
10
+ * Pull request [#35][]: Add VPC support. ([@jssjr][])
11
+ * Pull request [#34][]: Provide better information when the package can't be
12
+ downloaded. ([@erikh][])
13
+
14
+
1
15
  ## 1.0.0 / 2013-02-28
2
16
 
3
17
  ### Breaking Changes
@@ -20,7 +34,7 @@
20
34
  Scientific, RHEL, Amazon Linux, etc. Seriously, this is huge. ([@danryan][],
21
35
  [@erikh][])
22
36
  * Support for installing Chef 11 (erchef) servers from Omnibus packages.
23
- ([@fnicho][])
37
+ ([@fnichol][])
24
38
  * Add --log-level flag to help debug bootstrap template output. ([@fnichol][])
25
39
  * Support all relevant options from `Chef::Knife::Bootstrap` and
26
40
  `Chef::Knife::Ec2ServerCreate` in the standalone and ec2 subcommands. This
@@ -45,39 +59,36 @@
45
59
 
46
60
  ### Bug fixes
47
61
 
48
- * Pull request [#15](https://github.com/fnichol/knife-server/pull/15): Fix
49
- identity-file when `nil` is passed in. ([@erikh][])
62
+ * Pull request [#15][]: Fix identity-file when `nil` is passed in. ([@erikh][])
50
63
 
51
64
 
52
65
  ## 0.3.2 / 2012-12-19
53
66
 
54
67
  ### Improvements
55
68
 
56
- * Pull request [#13](https://github.com/fnichol/knife-server/pull/13): Relax
57
- version constraint on knife-ec2 gem. ([@wpeterson][])
58
- * Issue [#9](https://github.com/fnichol/knife-server/issues/9): Highlight the
59
- need to create set various knife.rb configuration settings. ([@fnichol][])
60
- * Issue [#10](https://github.com/fnichol/knife-server/issues/10),
61
- [#5](https://github.com/fnichol/knife-server/issues/5): Add more
62
- instructions in knife.rb setup section as using Knife may be new to many
63
- users of this gem. ([@fnichol][])
69
+ * Pull request [#13][]: Relax version constraint on knife-ec2 gem.
70
+ ([@wpeterson][])
71
+ * Issue [#9][]: Highlight the need to create set various knife.rb
72
+ configuration settings. ([@fnichol][])
73
+ * Issue [#10][], [#5][]: Add more instructions in knife.rb setup section as
74
+ using Knife may be new to many users of this gem. ([@fnichol][])
64
75
 
65
76
 
66
77
  ## 0.3.1 / 2012-12-12
67
78
 
68
79
  ### Bug fixes
69
80
 
70
- * Pull request [#7](https://github.com/fnichol/knife-server/pull/11): Fix
71
- identity-file flag for bootstrapping. ([@xdissent][])
72
- * Pull request [#11](https://github.com/fnichol/knife-server/pull/11): Fix
73
- identity-file flag for EC2 bootstrapping. ([@erikh][])
74
- * Pull request [#8](https://github.com/fnichol/knife-server/pull/8): Merge
75
- server config to Ec2ServerCreate config. ([@stormsilver][])
81
+ * Pull request [#7][]: Fix identity-file flag for bootstrapping.
82
+ ([@xdissent][])
83
+ * Pull request [#11][]: Fix identity-file flag for EC2 bootstrapping.
84
+ ([@erikh][])
85
+ * Pull request [#8][]: Merge server config to Ec2ServerCreate config.
86
+ ([@stormsilver][])
76
87
 
77
88
  ### Improvements
78
89
 
79
- * Pull request [#3](https://github.com/fnichol/knife-server/pull/3): Set
80
- server hostname even if /etc/hostname is not present. ([@iafonov][])
90
+ * Pull request [#3][]: Set server hostname even if /etc/hostname is not
91
+ present. ([@iafonov][])
81
92
  * Update usage section in README.
82
93
 
83
94
 
@@ -114,9 +125,8 @@
114
125
 
115
126
  ### Bug fixes
116
127
 
117
- * Issue [#2](https://github.com/fnichol/knife-server/issues/2): Improve
118
- documentation to clarify `knife server bootstrap` is not a proper
119
- subcommand. ([@fnichol][])
128
+ * Issue [#2][]: Improve documentation to clarify `knife server bootstrap` is
129
+ not a proper subcommand. ([@fnichol][])
120
130
 
121
131
  ### New features
122
132
 
@@ -129,10 +139,27 @@
129
139
 
130
140
  The initial release.
131
141
 
142
+
143
+ <!--- The following link definition list is generated by PimpMyChangelog --->
144
+ [#2]: https://github.com/fnichol/knife/issues/2
145
+ [#3]: https://github.com/fnichol/knife/issues/3
146
+ [#5]: https://github.com/fnichol/knife/issues/5
147
+ [#7]: https://github.com/fnichol/knife/issues/7
148
+ [#8]: https://github.com/fnichol/knife/issues/8
149
+ [#9]: https://github.com/fnichol/knife/issues/9
150
+ [#10]: https://github.com/fnichol/knife/issues/10
151
+ [#11]: https://github.com/fnichol/knife/issues/11
152
+ [#13]: https://github.com/fnichol/knife/issues/13
153
+ [#15]: https://github.com/fnichol/knife/issues/15
154
+ [#29]: https://github.com/fnichol/knife/issues/29
155
+ [#34]: https://github.com/fnichol/knife/issues/34
156
+ [#35]: https://github.com/fnichol/knife/issues/35
132
157
  [@danryan]: https://github.com/danryan
133
158
  [@erikh]: https://github.com/erikh
134
159
  [@fnichol]: https://github.com/fnichol
135
160
  [@iafonov]: https://github.com/iafonov
161
+ [@jssjr]: https://github.com/jssjr
162
+ [@ranjib]: https://github.com/ranjib
136
163
  [@stormsilver]: https://github.com/stormsilver
137
164
  [@wpeterson]: https://github.com/wpeterson
138
165
  [@xdissent]: https://github.com/xdissent
data/README.md CHANGED
@@ -52,7 +52,7 @@ $ knife server bootstrap standalone \
52
52
  --node-name chefapalooza.example.com \
53
53
  --host 192.168.33.10 \
54
54
  --ssh-user vagrant \
55
- --ssh--password vagrant
55
+ --ssh-password vagrant
56
56
  ```
57
57
 
58
58
  Taking a backup of all node, role, data bag, and environment data is also a
data/knife-server.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.add_development_dependency "rspec", "~> 2.10"
25
25
  gem.add_development_dependency "fakefs", "~> 0.4.0"
26
- gem.add_development_dependency "timecop", "~> 0.3.5"
26
+ gem.add_development_dependency "timecop", "~> 0.3"
27
27
  end
@@ -12,6 +12,7 @@ report_bug() {
12
12
  warn "Please file a bug report at https://github.com/fnichol/knife-server/issues"
13
13
  warn " "
14
14
  warn "Please detail your operating system, version and any other relevant details"
15
+ echo
15
16
  }
16
17
 
17
18
  exists() {
@@ -30,6 +30,23 @@ rpm_filename() {
30
30
  filename="chef-${version}.${machine}.rpm"
31
31
  }
32
32
 
33
+ failed_download() {
34
+ warn "We encountered an error downloading the package."
35
+ echo
36
+ exit 5
37
+ }
38
+
39
+ perform_download() {
40
+ case "$1" in
41
+ wget)
42
+ wget -O "$2" "$3" 2>/tmp/stderr || failed_download
43
+ ;;
44
+ curl)
45
+ curl -L "$3" > "$2" || failed_download
46
+ ;;
47
+ esac
48
+ }
49
+
33
50
  download_package() {
34
51
  if [ -f "/opt/chef-server/bin/chef-server-ctl" ] ; then
35
52
  info "Chef Server detected in /opt/chef-server, skipping download"
@@ -39,16 +56,18 @@ download_package() {
39
56
  local url="$(package_url)"
40
57
 
41
58
  banner "Downloading Chef Server package from $url to $tmp_dir/$filename"
59
+
42
60
  if exists wget;
43
61
  then
44
- wget -O "$tmp_dir/$filename" $url 2>/tmp/stderr
62
+ perform_download wget "$tmp_dir/$filename" $url
45
63
  elif exists curl;
46
64
  then
47
- curl -L $url > "$tmp_dir/$filename"
65
+ perform_download curl "$tmp_dir/$filename" $url
48
66
  else
49
67
  warn "Cannot find wget or curl - cannot install Chef Server!"
50
68
  exit 5
51
69
  fi
70
+
52
71
  info "Download complete"
53
72
  }
54
73
 
@@ -1,4 +1,4 @@
1
- bash -c '
1
+ bash <<'EOS'
2
2
  <%
3
3
  require 'erb'
4
4
 
@@ -45,7 +45,7 @@ add_opscode_apt_repo() {
45
45
  apt-get update
46
46
  # permanent upgradeable keyring
47
47
  apt-get install -y --force-yes opscode-keyring
48
- apt-get upgrade -y
48
+ apt-get dist-upgrade -y
49
49
  }
50
50
 
51
51
  preseed_chef_pkg() {
@@ -64,7 +64,8 @@ PRESEED
64
64
  install_chef_server() {
65
65
  preseed_chef_pkg
66
66
 
67
- apt-get install -y --force-yes chef chef-server libshadow-ruby1.8
67
+ apt-get update
68
+ apt-get install -y chef chef-server libshadow-ruby1.8
68
69
  }
69
70
 
70
71
  config_chef_solo() {
@@ -105,5 +106,5 @@ add_opscode_apt_repo
105
106
  install_chef_server
106
107
  enable_ssl_proxy
107
108
 
108
- banner "Bootstraping Chef Server on ${hostname} is complete."
109
- '
109
+ banner "Bootstrapping Chef Server on ${hostname} is complete."
110
+ EOS
@@ -181,5 +181,5 @@ set_hostname_for_${platform}
181
181
  install_chef_server
182
182
  configure_firewall
183
183
 
184
- printf -- "-----> Bootstraping Chef Server on ${hostname} is complete.\n"
184
+ printf -- "-----> Bootstrapping Chef Server on ${hostname} is complete.\n"
185
185
  '
@@ -25,6 +25,7 @@ export prerelease="<%= @config[:prerelease] == true %>"
25
25
  export webui_enable="<%= @chef_config[:knife][:webui_enable] == true %>"
26
26
  export webui_password="<%= ENV['WEBUI_PASSWORD'] %>"
27
27
  export amqp_password="<%= ENV['AMQP_PASSWORD'] %>"
28
+ export no_test="<%= ENV['NO_TEST'] %>"
28
29
 
29
30
  <%= render "common.sh" %>
30
31
 
@@ -57,8 +58,11 @@ install_package
57
58
  prepare_chef_server_rb
58
59
  symlink_binaries
59
60
  reconfigure_chef_server
60
- test_chef_server
61
+ if [ ! -n "$no_test"]
62
+ then
63
+ test_chef_server
64
+ fi
61
65
  configure_firewall
62
66
 
63
- banner "Bootstraping Chef Server on ${hostname} is complete."
67
+ banner "Bootstrapping Chef Server on ${hostname} is complete."
64
68
  '
@@ -138,5 +138,5 @@ run_chef_solo
138
138
  configure_firewall
139
139
  cleanup
140
140
 
141
- echo "-----> Bootstraping Chef Server on ${hostname} is complete."
141
+ echo "-----> Bootstrapping Chef Server on ${hostname} is complete."
142
142
  '
@@ -73,6 +73,11 @@ class Chef
73
73
  :description => "Set the log level (debug, info, warn, error, fatal)",
74
74
  :proc => Proc.new { |v| Chef::Config[:knife][:log_level] = v.to_sym },
75
75
  :default => :error
76
+
77
+ option :no_test,
78
+ :short => "-n",
79
+ :long => "--no-test",
80
+ :description => "Do not run opscode pedant as a part of the omnibus installation"
76
81
  end
77
82
  end
78
83
 
@@ -67,8 +67,9 @@ class Chef
67
67
  end
68
68
 
69
69
  def ec2_bootstrap
70
- ENV['WEBUI_PASSWORD'] = config[:webui_password]
71
- ENV['AMQP_PASSWORD'] = config[:amqp_password]
70
+ ENV['WEBUI_PASSWORD'] = config_val(:webui_password)
71
+ ENV['AMQP_PASSWORD'] = config_val(:amqp_password)
72
+ ENV['NO_TEST'] = "1" if config[:no_test]
72
73
  bootstrap = Chef::Knife::Ec2ServerCreate.new
73
74
  Chef::Knife::Ec2ServerCreate.options.keys.each do |attr|
74
75
  bootstrap.config[attr] = config_val(attr)
@@ -111,10 +112,13 @@ class Chef
111
112
  end
112
113
 
113
114
  def config_security_group(name = nil)
114
- name = config_val(:security_groups).first if name.nil?
115
-
116
- ::Knife::Server::Ec2SecurityGroup.new(ec2_connection, ui).
117
- configure_chef_server_group(name, :description => "#{name} group")
115
+ if config[:security_group_ids].nil? || config[:security_group_ids].empty?
116
+ name = config_val(:security_groups).first if name.nil?
117
+ ::Knife::Server::Ec2SecurityGroup.new(ec2_connection, ui).
118
+ configure_chef_server_group(name, :description => "#{name} group")
119
+ else
120
+ config[:security_groups] = nil
121
+ end
118
122
  end
119
123
 
120
124
  def bootstrap_tags
@@ -52,13 +52,15 @@ class Chef
52
52
  end
53
53
 
54
54
  def standalone_bootstrap
55
- ENV['WEBUI_PASSWORD'] = config[:webui_password]
56
- ENV['AMQP_PASSWORD'] = config[:amqp_password]
55
+ ENV['WEBUI_PASSWORD'] = config_val(:webui_password)
56
+ ENV['AMQP_PASSWORD'] = config_val(:amqp_password)
57
+ ENV['NO_TEST'] = "1" if config[:no_test]
57
58
  bootstrap = Chef::Knife::Bootstrap.new
58
59
  bootstrap.name_args = [ config[:host] ]
59
60
  Chef::Knife::Bootstrap.options.keys.each do |attr|
60
61
  bootstrap.config[attr] = config_val(attr)
61
62
  end
63
+ bootstrap.ui = self.ui
62
64
  bootstrap.config[:distro] = bootstrap_distro
63
65
  bootstrap.config[:use_sudo] = true unless config_val(:ssh_user) == "root"
64
66
  bootstrap
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Knife
20
20
  module Server
21
- VERSION = "1.0.0"
21
+ VERSION = "1.0.1"
22
22
  end
23
23
  end
@@ -107,6 +107,17 @@ describe Chef::Knife::ServerBootstrapStandalone do
107
107
  bootstrap.should be_a(Chef::Knife::Bootstrap)
108
108
  end
109
109
 
110
+ it "copies our UI object to the bootstrap object" do
111
+ bootstrap.ui.object_id.should eq(@knife.ui.object_id)
112
+ end
113
+
114
+ it "sets NO_TEST in the environment when the option is provided" do
115
+ @knife.config[:no_test] = true
116
+ bootstrap.should_not be_nil
117
+ ENV["NO_TEST"].should eq("1")
118
+ ENV.delete("NO_TEST")
119
+ end
120
+
110
121
  it "configs the bootstrap's chef_node_name" do
111
122
  bootstrap.config[:chef_node_name].should eq("shave.yak")
112
123
  end
@@ -209,7 +220,7 @@ describe Chef::Knife::ServerBootstrapStandalone do
209
220
  end
210
221
 
211
222
  let(:bootstrap) do
212
- stub(:run => true, :config => Hash.new, :name_args= => true)
223
+ stub(:run => true, :config => Hash.new, :ui= => true, :name_args= => true)
213
224
  end
214
225
 
215
226
  let(:ssh) { stub(:exec! => true) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 0.3.5
117
+ version: '0.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 0.3.5
125
+ version: '0.3'
126
126
  description: Chef Knife plugin to bootstrap Chef Servers
127
127
  email:
128
128
  - fnichol@nichol.ca
@@ -179,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 2065345583583086223
182
+ hash: -2573931868041806838
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  segments:
190
190
  - 0
191
- hash: 2065345583583086223
191
+ hash: -2573931868041806838
192
192
  requirements: []
193
193
  rubyforge_project:
194
194
  rubygems_version: 1.8.24