qops 1.4.3 → 1.4.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42e47dc490e28da0f8d6c2c9a040d0b84708f09b
4
- data.tar.gz: 7045e80b70da5f36b63d647436c8cb334fd99fce
3
+ metadata.gz: c0c9b4d83a9c50a14d230be5ee24da52ef5bd414
4
+ data.tar.gz: 53bc8c501afd3e9edae0f3efa950f719f695cdb7
5
5
  SHA512:
6
- metadata.gz: bf0bb0d96a9db7f3855b4a4aceb308be596c775c96980a46a9992c2195bda1cdd90b34f318cf342a43b7e19d655561b4265bbfb1fb8ad8feeae72d90c54d4b0b
7
- data.tar.gz: 569864c4f98fefadc8c12957fc4ed8120174b3730bf1dc099bd1fb851dc18795a4d5a5dbda0735ccf0ae1ff0ae4eaaaf99df3a111961195c2921f2773ad3fa46
6
+ metadata.gz: 7ca556cc6964ffe542f7b5e585390d156255c1fb1b0694d7d50975af7d11fd059d0c40e5eb6a10965c0325412d4756beeb48064cca96cee2d1e25864501b7323
7
+ data.tar.gz: 1769474f6e6c8a39c16ebe8c3340526d16838cde73f83813a45f8bff06e14aa6bba3cbb1e9cb57be796c24f5147f37275fb727282231312f35f315a166a0da42
@@ -120,7 +120,7 @@ class Qops::Cookbook < Thor
120
120
 
121
121
  @_config ||= Qops::Environment.new
122
122
 
123
- %w(cookbook_dir cookbook_s3_bucket cookbook_s3_path cookbook_name cookbook_version).each do |var|
123
+ %w[cookbook_dir cookbook_s3_bucket cookbook_s3_path cookbook_name cookbook_version].each do |var|
124
124
  fail ArgumentError.new("Must specify a '#{var}' in the config") if !@_config.respond_to?(var) && !@_config.configuration.respond_to?(var)
125
125
  end
126
126
 
@@ -12,7 +12,7 @@ class Qops::Deploy < Thor
12
12
  end
13
13
  online_instances = instances.select { |instance| instance.status == 'online' }
14
14
 
15
- if online_instances.count == 0
15
+ if online_instances.zero?
16
16
  raise 'Could not find any running instance(s) to deploy to. Perhaps you need to run "qops:instance:up" first'
17
17
  end
18
18
 
@@ -17,7 +17,7 @@ module Qops::DeployHelpers
17
17
  Qops::Environment.notifiers
18
18
  @_config ||= Qops::Environment.new
19
19
 
20
- fail "Invalid configure deploy_type detected: #{@_config.deploy_type}" unless %w(staging production).include?(@_config.deploy_type)
20
+ fail "Invalid configure deploy_type detected: #{@_config.deploy_type}" unless %w[staging production].include?(@_config.deploy_type)
21
21
 
22
22
  @_config
23
23
  end
@@ -17,7 +17,7 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
17
17
  stack_id: config.stack_id,
18
18
  layer_ids: [config.layer_id],
19
19
  instance_type: config.instance_type,
20
- os: 'Ubuntu 14.04 LTS',
20
+ os: config.os,
21
21
  hostname: requested_hostname,
22
22
  subnet_id: config.subnet,
23
23
  auto_scaling_type: config.autoscale_type,
@@ -55,7 +55,7 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
55
55
 
56
56
  # Start the instance if necessary
57
57
  print 'Booting instance ...'
58
- unless %w(online booting).include?(instance.status)
58
+ unless %w[online booting].include?(instance.status)
59
59
  config.opsworks.start_instance(instance_id: instance_id)
60
60
  end
61
61
 
@@ -70,7 +70,7 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
70
70
  instance_results = config.opsworks.describe_instances(instance_ids: [instance_id])
71
71
  instance = instance_results.data.instances.first
72
72
 
73
- if %w(booting requested pending).include?(instance.status)
73
+ if %w[booting requested pending].include?(instance.status)
74
74
  print '.'
75
75
  print " #{instance.status} :" if been_a_minute?(i)
76
76
  else
@@ -196,9 +196,9 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
196
196
 
197
197
  puts "Preparing to run command to all servers (#{instances.map(&:hostname).join(', ')})"
198
198
 
199
- command = ask('Which command you want to execute?', limited_to: %w(setup configure install_dependencies update_dependencies))
199
+ command = ask('Which command you want to execute?', limited_to: %w[setup configure install_dependencies update_dependencies])
200
200
 
201
- option = ask('Which command you want to execute?', limited_to: %w(all_in_once one_by_one))
201
+ option = ask('Which command you want to execute?', limited_to: %w[all_in_once one_by_one])
202
202
 
203
203
  base_deployment_params = {
204
204
  stack_id: config.stack_id,
@@ -259,9 +259,10 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
259
259
  end
260
260
 
261
261
  def setup_instance(instance, initial_instance_state, manifest)
262
+ print 'Setup instance ...'
263
+
262
264
  # If the previous instance setup failed then run the setup task again when trying to bring up the instance.
263
265
  if initial_instance_state.status == 'setup_failed'
264
- print 'Setup instance ...'
265
266
  run_opsworks_command(
266
267
  {
267
268
  stack_id: config.stack_id,
@@ -274,15 +275,14 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
274
275
 
275
276
  # Monitor the existing instance setup.
276
277
  else
277
- print 'Setup instance ...'
278
278
  iterator(manifest) do |i|
279
279
  instance_results = config.opsworks.describe_instances(instance_ids: [instance.instance_id])
280
280
  instance = instance_results.data.instances.first
281
281
 
282
- if %w(online).include?(instance.status)
282
+ if %w[online].include?(instance.status)
283
283
  puts ' ' + instance.status
284
284
  true
285
- elsif %w(setup_failed).include?(instance.status)
285
+ elsif %w[setup_failed].include?(instance.status)
286
286
  puts ' ' + instance.status
287
287
  read_failure_log(
288
288
  { instance_id: instance.instance_id },
@@ -32,7 +32,7 @@ module Qops
32
32
  end
33
33
 
34
34
  def initialize
35
- %w(deploy_type region stack_id app_name).each do |v|
35
+ %w[deploy_type region stack_id app_name].each do |v|
36
36
  fail "Please configure #{v} before continuing." unless option?(v)
37
37
  end
38
38
 
@@ -68,13 +68,17 @@ module Qops
68
68
  configuration.autoscale_type || nil
69
69
  end
70
70
 
71
+ def opsworks_os
72
+ configuration.os || 'Ubuntu 14.04 LTS'
73
+ end
74
+
71
75
  # Default 1 days
72
76
  def max_instance_duration
73
77
  configuration.max_instance_duration || 86_400
74
78
  end
75
79
 
76
80
  def clean_commands_to_ignore
77
- configuration.clean_commands_to_ignore.present? ? configuration.clean_commands_to_ignore : %w(update_custom_cookbooks update_agent configure shutdown)
81
+ configuration.clean_commands_to_ignore.present? ? configuration.clean_commands_to_ignore : %w[update_custom_cookbooks update_agent configure shutdown]
78
82
  end
79
83
 
80
84
  def file_name
@@ -106,12 +110,12 @@ module Qops
106
110
  end
107
111
 
108
112
  def ebs_optimize
109
- !configuration.ebs_optimize.nil? ? configuration.ebs_optimize : !!(deploy_type =~ /production/) # rubocop:disable Style/DoubleNegation
113
+ !configuration.ebs_optimize.nil? ? configuration.ebs_optimize : !deploy_type !~ /production/
110
114
  end
111
115
 
112
116
  private
113
117
 
114
- def method_missing(method_sym, *arguments, &block)
118
+ def method_missing(method_sym, *arguments, &block) # rubocop:disable Style/MethodMissing
115
119
  if configuration.respond_to?(method_sym)
116
120
  configuration.send(method_sym, *arguments, &block)
117
121
  else
@@ -17,7 +17,7 @@ module Qops::Helpers
17
17
  end
18
18
 
19
19
  def been_a_minute?(i)
20
- i > 1 && i % 60 == 0
20
+ i > 1 && (i % 60).zero?
21
21
  end
22
22
 
23
23
  def iterator(options)
@@ -126,7 +126,7 @@ module Qops::Helpers
126
126
  if File.exist?(file_path) # rubocop:disable Style/GuardClause
127
127
  raw_config = File.read(file_path)
128
128
  erb_config = ERB.new(raw_config).result
129
- configs = YAML.load(erb_config)
129
+ configs = YAML.safe_load(erb_config)
130
130
 
131
131
  env = options[:environment]
132
132
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Qops
3
- VERSION = '1.4.3'.freeze
4
+ VERSION = '1.4.5'.freeze
4
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qops
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Basset
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-05-27 00:00:00.000000000 Z
14
+ date: 2017-04-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: qthor
@@ -135,9 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.4
138
+ rubygems_version: 2.6.10
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Helper commands for deployment of opsworks projects.
142
142
  test_files: []
143
- has_rdoc: