qops 1.7.2 → 1.8.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
  SHA256:
3
- metadata.gz: a1e04664fb5d8cf82677fb1f6ce109ea12209e48c338d5cfdc533a2b9537f337
4
- data.tar.gz: 3e328659635aef9ce2d5ecda36e491044e4c94e65efbac33212f7cd8f8bc19b2
3
+ metadata.gz: 4049541294838f48e024d89b6f27e177759922825a1b677dd6a69a59a6cffc0f
4
+ data.tar.gz: 56e6206d57b52db47c30173042306fb4b2df652d2cdf1830b47ca5a5753f2870
5
5
  SHA512:
6
- metadata.gz: c00d582dc9c65fd047de71b8fccbf2d7d0e8c64259bb1dea2c35881bb2e82c3ecee18ba0f5d5678617d98d89bbb4d0e88cc8dabfebdbbd7970bb48b2864de0e2
7
- data.tar.gz: 05aa9df5663df7b5cb27b562810984e84680483dcecc559efd86427444d5ca39904a5da9c9b025ab92b9c8a688f3fa1824374173807156a3837874337a94ea1c
6
+ metadata.gz: 81010cc6a100a146b98cdcaaa55b2f459003d7a52b7dc76bd2fbb8f663191276a0404583ba6b7c5863dcc4ad7cd4a836546dcd639cb5cda63b9d7da01c205cf3
7
+ data.tar.gz: 667dd082becededba41b723bdfa06434528a32eb377f6ea6d42cd5b8ee27ed28f05abdbb33469e3c2290c24c7006ccde07fbfe48474469061db8d4b880c01667
data/README.md CHANGED
@@ -14,13 +14,11 @@
14
14
  You can create a overridden_built_in_templates folder within you cookbooks folder.
15
15
  /cookbooks/overridden_built_in_templates/unicorn/templates/default/unicorn.conf.erb
16
16
 
17
- ### Q: The `qops` gem is currently not public. How do I access it?
18
-
19
- Please add your personal gemfury source to the gem path to install it.
20
-
21
17
  ### Q: For the `qops qops:instance:run_command` command, it provides two options: one is run commands against all instances of the stack all in once, one is run commands on each instances of the stack one by one randomly. How do I use this?
22
18
 
23
- When running commands one by one, between each execution of the command, there will be a delay. The delay is config by wait_deploy. By default it is 180 seconds when it is not defined. For now, run_command command will only support commends `setup` `configure` `install_dependencies` `update_dependencies`, since commands `update_custom_cookbooks` `deploy` was implemented before.
19
+ When running commands one by one, between each execution of the command, there will be a delay. The delay is config by wait_deploy. By default it is 180 seconds when it is not defined. For now, run_command command will only support commends `setup` `configure` `install_dependencies` `update_dependencies`, `execute_recipes`, since commands `update_custom_cookbooks` `deploy` was implemented before.
20
+
21
+ When run command `execute_recipes`, a comma separated recipes should be supply, for example: cookbookname::recipename_one,cookbookname::recipename_two
24
22
 
25
23
  ### Q: How do I use QOPS to override env variables on my opsworks CHEF 11 stack?
26
24
 
@@ -12,6 +12,9 @@ module Qops::DeployHelpers
12
12
  class_option :profile, type: :string, aliases: '-p', desc: 'An AWS profile to use'
13
13
  class_option :force_config, type: :boolean, aliases: '-f', desc: 'Force qops to read options from config. by default qops will search aws opsworks stack'
14
14
  class_option :verbose, type: :boolean, aliases: '-v', desc: 'Provides additional information when running for debugging purposes.'
15
+ class_option :command_for_run_command, type: :string, aliases: '-c', desc: 'The command to use when run_command'
16
+ class_option :recipes, type: :string, aliases: '-r', desc: 'The recipes to use when run_command execute_recipes'
17
+ class_option :options_for_run_command, type: :string, aliases: '-o', desc: 'options for run_command such as current, all_in_once or one_by_one'
15
18
  end
16
19
 
17
20
  private
@@ -192,20 +192,42 @@ class Qops::Instance < Thor # rubocop:disable Metrics/ClassLength
192
192
  initialize_run
193
193
  instances = retrieve_instances
194
194
 
195
- puts "Preparing to run command to all servers (#{instances.map(&:hostname).join(', ')})"
195
+ command = options[:command_for_run_command] || ask('Which command you want to execute?', limited_to: %w[setup configure install_dependencies update_dependencies execute_recipes])
196
196
 
197
- command = ask('Which command you want to execute?', limited_to: %w[setup configure install_dependencies update_dependencies])
197
+ option = options[:options_for_run_command] || ask('Which command you want to execute?', limited_to: %w[current all_in_once one_by_one])
198
198
 
199
- option = ask('Which command you want to execute?', limited_to: %w[all_in_once one_by_one])
199
+ puts "Preparing to run command to all servers (#{instances.map(&:hostname).join(', ')})" if option != 'current'
200
+
201
+ recipes = options[:recipes] || ask('Recipes list?') if command == 'execute_recipes'
200
202
 
201
203
  base_deployment_params = {
202
204
  stack_id: config.stack_id,
203
- command: { name: command.to_s }
205
+ command: {
206
+ name: command.to_s
207
+ }
204
208
  }
205
209
 
210
+ base_deployment_params[:command][:args] = { recipes: recipes.split(',') } if recipes
211
+
212
+ puts "#{base_deployment_params}"
213
+
206
214
  manifest = { environment: config.deploy_type }
207
215
 
208
216
  case option
217
+ when 'current'
218
+
219
+ instance = retrieve_instance if config.deploy_type == 'staging'
220
+
221
+ if instance.nil?
222
+ puts 'No instance available to execute_recipes'
223
+ exit(0)
224
+ else
225
+ instance_id = instance.instance_id
226
+ end
227
+
228
+ print "Run command #{command} on instance #{instance_id}"
229
+ deployment_params = base_deployment_params.deep_dup
230
+ run_opsworks_command(base_deployment_params, [instance_id])
209
231
  when 'all_in_once'
210
232
  print "Run command #{command} on all instances at once ..."
211
233
  deployment_params = base_deployment_params.deep_dup
data/lib/qops/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Qops
4
- VERSION = '1.7.2'
4
+ VERSION = '1.8.0'
5
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.7.2
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Basset
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-06-18 00:00:00.000000000 Z
15
+ date: 2019-08-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -21,6 +21,9 @@ dependencies:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 4.2.1
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
24
27
  type: :runtime
25
28
  prerelease: false
26
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,6 +31,9 @@ dependencies:
28
31
  - - ">="
29
32
  - !ruby/object:Gem::Version
30
33
  version: 4.2.1
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6.0'
31
37
  - !ruby/object:Gem::Dependency
32
38
  name: aws-sdk
33
39
  requirement: !ruby/object:Gem::Requirement
@@ -137,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
143
  - !ruby/object:Gem::Version
138
144
  version: '0'
139
145
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.7.4
146
+ rubygems_version: 3.0.4
142
147
  signing_key:
143
148
  specification_version: 4
144
149
  summary: Helper commands for deployment of opsworks projects.