berkflow 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85c341823406e944b861468b054d7159d5122540
4
- data.tar.gz: 84a1a355597ae2f81080a7af9cc2f4c032779a6a
3
+ metadata.gz: 24c520495a983a7e8d942ac01d9751077401f8a8
4
+ data.tar.gz: f8516a6f5e8b830d038da357cd48c6700c21d3c6
5
5
  SHA512:
6
- metadata.gz: c128d37108060fdbf5d1116b64dcdb9462e6d2a84af40918d75305ca6583acc20c8dcb97f4a7c92586770fcb68466d397e8aa50609b7a0b6c8fa2927d18e8e89
7
- data.tar.gz: 0434b8a4fb6fc9ccf54e300e30e555d0fe40892842fd5d02a9da74f22b11e6320b1613d046ee35cd7275484bee8aa5083561fcd208689fa2a7f49bd34be8f7be
6
+ metadata.gz: 5d5decb374e5d427e12ec9017c245edfd3b36c665376f03f302c2e1ca4da17675dc82c59a04cd5067524e342af2fb5ac5deaa8cc2b93bf23aa4747d08ad8ce20
7
+ data.tar.gz: 0cc37c202e129473cd32bfeaeb63c1ec6655ed0a69d0fcfd5b78650f8d8e23484f0ac62d8c6ae739a697683317cf82b1424f3a578ee413ed4e2cee5d1dde5197
@@ -1,3 +1,11 @@
1
+ # 0.7.0
2
+
3
+ * Enhancements
4
+ * Add `--connect-attribute` flag (`-a`) to specify using public hostname or ipv4 when connecting to nodes
5
+
6
+ * Bug Fixes
7
+ * Silence erroneous error and warning outputs
8
+
1
9
  # 0.6.3
2
10
 
3
11
  * Bug Fixes
data/README.md CHANGED
@@ -6,11 +6,11 @@ A command line tool for managing Chef Environments using Berkshelf and the [Envi
6
6
 
7
7
  ## Requirements
8
8
 
9
- * [ChefDK](http://getchef.com/downloads/chef-dk) >= 0.2.0
9
+ * [Chef-DK](https://downloads.chef.io/chef-dk/) >= 0.2.0
10
10
 
11
11
  ## Installation
12
12
 
13
- Install the [Chef-DK](http://getchef.com/downloads/chef-dk) and add it, and it's gem binaries directory to your path
13
+ Install the [Chef-DK](https://downloads.chef.io/chef-dk/) and add it, and it's gem binaries directory to your path
14
14
 
15
15
  $ export PATH=/opt/chefdk/bin:$HOME/.chefdk/gem/ruby/2.1.0/bin:$PATH
16
16
 
@@ -4,8 +4,27 @@ require 'ridley'
4
4
  require 'ridley-connectors'
5
5
  require 'berkshelf'
6
6
 
7
- Celluloid.logger.level = ::Logger::ERROR
8
-
9
7
  module Berkflow
10
- # Your code goes here...
8
+ class << self
9
+ def debug?
10
+ !ENV['DEBUG'].nil?
11
+ end
12
+
13
+ def setup
14
+ if debug?
15
+ Ridley.logger.level = Logger::DEBUG
16
+ Berkshelf.logger.level = Logger::DEBUG
17
+ else
18
+ # Disable Celluloid logging to silence erronous warnings and errors. This
19
+ # will be re-enabled in the future once the cause of false crash reports
20
+ # on shutdown is identified and fixed.
21
+ Celluloid.logger = nil
22
+
23
+ Ridley.logger.level = Logger::ERROR
24
+ Berkshelf.logger.level = Logger::ERROR
25
+ end
26
+ end
27
+ end
11
28
  end
29
+
30
+ Berkflow.setup
@@ -145,6 +145,12 @@ module Berkflow
145
145
  type: :boolean,
146
146
  desc: "Execute with sudo",
147
147
  default: false
148
+ method_option :connect_attribute,
149
+ aliases: "-a",
150
+ type: :string,
151
+ desc: "The attribute to use for opening the connection",
152
+ enum: ["ipv4", "hostname"],
153
+ default: "hostname"
148
154
  desc "exec ENV CMD", "execute an arbitrary shell command on all nodes in an environment."
149
155
  def exec(environment, command)
150
156
  env = find_environment!(environment)
@@ -158,7 +164,9 @@ module Berkflow
158
164
  end
159
165
 
160
166
  say "Executing command on #{nodes.length} nodes..."
161
- success, failures, out = handle_results nodes.pmap { |node| ridley.node.run(node.public_hostname, command) }
167
+ success, failures, out = handle_results nodes.pmap { |node|
168
+ ridley.node.run connect_address(node, options), command
169
+ }
162
170
 
163
171
  unless success.empty?
164
172
  say "Successfully executed command on #{success.length} nodes"
@@ -172,6 +180,12 @@ module Berkflow
172
180
  failures.empty? ? exit(0) : exit(1)
173
181
  end
174
182
 
183
+ method_option :connect_attribute,
184
+ aliases: "-a",
185
+ type: :string,
186
+ desc: "The attribute to use for opening the connection",
187
+ enum: ["ipv4", "hostname"],
188
+ default: "hostname"
175
189
  desc "run_chef ENV", "run chef on all nodes in the given environment."
176
190
  def run_chef(environment)
177
191
  env = find_environment!(environment)
@@ -185,7 +199,9 @@ module Berkflow
185
199
  end
186
200
 
187
201
  say "Running Chef Client on #{nodes.length} nodes..."
188
- success, failures, out = handle_results nodes.pmap { |node| ridley.node.chef_run(node.public_hostname) }
202
+ success, failures, out = handle_results nodes.pmap { |node|
203
+ ridley.node.chef_run connect_address(node, options)
204
+ }
189
205
 
190
206
  unless success.empty?
191
207
  say "Successfully ran Chef Client on #{success.length} nodes"
@@ -209,6 +225,12 @@ module Berkflow
209
225
  aliases: "-s",
210
226
  desc: "Skip running chef-client on nodes in specified environment",
211
227
  default: false
228
+ method_option :connect_attribute,
229
+ aliases: "-a",
230
+ type: :string,
231
+ desc: "The attribute to use for opening the connection",
232
+ enum: ["ipv4", "hostname"],
233
+ default: "hostname"
212
234
  desc "upgrade ENV APP [VERSION]", "upgrade an environment to the specified cookbook version."
213
235
  long_desc <<-EOH
214
236
  Upgrades an environment to the specified cookbook version. If no version is given then the latest
@@ -269,6 +291,17 @@ module Berkflow
269
291
  Berkshelf::Config.instance
270
292
  end
271
293
 
294
+ def connect_address(node, options)
295
+ address = case options[:connect_attribute].downcase
296
+ when "ipv4"
297
+ node.public_ipv4
298
+ when "hostname"
299
+ node.public_hostname
300
+ else
301
+ node.public_hostname
302
+ end
303
+ end
304
+
272
305
  def handle_results(result_set)
273
306
  failure, success = result_set.partition { |result| result.error? }
274
307
  log_dir = log_results(success, failure)
@@ -1,3 +1,3 @@
1
1
  module Berkflow
2
- VERSION = "0.6.3"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-02 00:00:00.000000000 Z
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semverse