convection 2.1.1 → 2.1.2

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: 02061f0e91085ee63ba5222db6991c4eba1a446e
4
- data.tar.gz: c4f5a62d21357e404e7fd4e2ec287f38af0e2e38
3
+ metadata.gz: 2c47278ea072d6254e3d9b6bd60ff0b34b26d5c5
4
+ data.tar.gz: eae63705e881e7b7efa4cc2a5c3376bc453f39b1
5
5
  SHA512:
6
- metadata.gz: 669379f7312d53a65a6cd02294b9f786028a2bfabd31c8a2fa19476da0e6f7af697630bf23eb76622a833d2e6c20ae072f7c1191b5eafa2877e736e4781bd490
7
- data.tar.gz: 0cc22c3896003722f701ac226d4e60254313f73e9cae8c0dfc9d28c9a74997ce1c68f9de107bbea8028bbef1e503b540eac68710c3c3ce810054c7efea5835b9
6
+ metadata.gz: b6655098f7f79a48236e71f5c20df2a2c236aa3fed7025789d92642df1369d763ec5e70a8e71436f363e062d7549520c6959e5e83452bd454229f0d84bf0f0a0
7
+ data.tar.gz: 7f8a5150e724eea1ce80a5a6d25a6da6520233242a5a53f985225dabc3739fecc2693269052c75dec5a320e0ef11838cc3305a37dd14e4154af7fc0c48db167a
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3
data/.travis.yml CHANGED
@@ -1,7 +1,12 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
4
- - 2.2.1
5
- - 2.2.2
6
- - 2.3.0
3
+ - 2.2.8
4
+ - 2.3.5
5
+ - 2.4.2
7
6
  sudo: false
7
+ before_install:
8
+ - gem update bundler
9
+ - gem update --system
10
+ branches:
11
+ only:
12
+ - master
data/bin/convection CHANGED
@@ -18,6 +18,7 @@ module Convection
18
18
  desc 'converge STACK', 'Converge your cloud'
19
19
  option :stack_group, :type => :string, :desc => 'The name of a stack group defined in your cloudfile to converge'
20
20
  option :stacks, :type => :array, :desc => 'A ordered space separated list of stacks to converge'
21
+ option :exclude_stacks, :type => :array, :desc => 'A ordered space separated list of stacks NOT to converge'
21
22
  option :verbose, :type => :boolean, :aliases => '--v', :desc => 'Show stack progress', default: true
22
23
  option :'very-verbose', :type => :boolean, :aliases => '--vv', :desc => 'Show unchanged stacks', default: true
23
24
  option :cloudfiles, :type => :array, :default => %w(Cloudfile)
@@ -56,6 +57,7 @@ module Convection
56
57
  desc 'diff STACK', 'Show changes that will be applied by converge'
57
58
  option :stack_group, :type => :string, :desc => 'The name of a stack group defined in your cloudfile to diff'
58
59
  option :stacks, :type => :array, :desc => 'A ordered space separated list of stacks to diff'
60
+ option :exclude_stacks, :type => :array, :desc => 'A ordered space separated list of stacks NOT to diff'
59
61
  option :verbose, :type => :boolean, :aliases => '--v', :desc => 'Show stack progress'
60
62
  option :'very-verbose', :type => :boolean, :aliases => '--vv', :desc => 'Show unchanged stacks'
61
63
  option :cloudfiles, :type => :array, :default => %w(Cloudfile)
@@ -131,7 +133,7 @@ module Convection
131
133
  cloud_array[:cloud].configure(File.absolute_path(cloud_array[:cloudfile_path], @cwd))
132
134
  cloud = cloud_array[:cloud]
133
135
  region = cloud.cloudfile.region
134
- cloud.send(task_name, stack, stack_group: options[:stack_group], stacks: options[:stacks]) do |event, errors|
136
+ cloud.send(task_name, stack, stack_group: options[:stack_group], stacks: options[:stacks], exclude_stacks: options[:exclude_stacks]) do |event, errors|
135
137
  if options[:cloudfiles].length > 1 && options[:delayed_output]
136
138
  output << { event: event, errors: errors }
137
139
  else
@@ -22,31 +22,48 @@ module Convection
22
22
  end
23
23
 
24
24
  def filter_deck(options = {}, &block)
25
- # throw an error if the user specifies both a stack group and list of stacks
26
- if options[:stack_group] && options[:stacks]
27
- block.call(Model::Event.new(:error, 'Cannot specify --stack-group and --stack-list at the same time', :error)) if block
25
+ # throw an error if the user specifies more than one (stack group, list of stacks, exclusion list of stacks)
26
+ if (options[:stack_group] && options[:stacks]) ||
27
+ (options[:stack_group] && options[:exclude_stacks]) ||
28
+ (options[:stacks] && options[:exclude_stacks])
29
+ block.call(Model::Event.new(:error, 'Cannot specify --stack-group , --stack-list, or --exclude-stacks at the same time as each other', :error)) if block
28
30
  return {}
29
31
  end
30
32
 
31
- # throw an error if the user specifies a nonexistent stack groups
32
- if options[:stack_group] && !stack_groups.key?(options[:stack_group])
33
- block.call(Model::Event.new(:error, "Unknown stack group: #{options[:stack_group]}", :error)) if block
34
- return {}
35
- end
33
+ if options[:stack_group] || options[:stacks]
34
+ # throw an error if the user specifies a nonexistent stack groups
35
+ if options[:stack_group] && !stack_groups.key?(options[:stack_group])
36
+ block.call(Model::Event.new(:error, "Unknown stack group: #{options[:stack_group]}", :error)) if block
37
+ return {}
38
+ end
36
39
 
37
- # throw an error if the user specifies nonexistent stacks
38
- if Array(options[:stacks]).any? { |name| !@cloudfile.stacks.key?(name) }
39
- bad_stack_names = options[:stacks].reject { |name| @cloudfile.stacks.key?(name) }
40
- block.call(Model::Event.new(:error, "Undefined Stack(s) #{bad_stack_names.join(', ')}", :error)) if block
41
- return {}
42
- end
40
+ # throw an error if the user specifies nonexistent stacks
41
+ if Array(options[:stacks]).any? { |name| !@cloudfile.stacks.key?(name) }
42
+ bad_stack_names = options[:stacks].reject { |name| @cloudfile.stacks.key?(name) }
43
+ block.call(Model::Event.new(:error, "Undefined Stack(s) #{bad_stack_names.join(', ')}", :error)) if block
44
+ return {}
45
+ end
46
+
47
+ filter = Array(stack_groups[options[:stack_group]] || options[:stacks])
48
+ filter.reduce({}) do |result, stack_name|
49
+ result.merge(stack_name => @cloudfile.stacks[stack_name])
50
+ end
51
+
52
+ elsif options[:exclude_stacks]
53
+ # throw an error if the user specifies nonexistent excluded stacks
54
+ if Array(options[:exclude_stacks]).any? { |name| !@cloudfile.stacks.key?(name) }
55
+ bad_stack_names = options[:exclude_stacks].reject { |name| @cloudfile.stacks.key?(name) }
56
+ block.call(Model::Event.new(:error, "Undefined Stack(s) #{bad_stack_names.join(', ')}", :error)) if block
57
+ return {}
58
+ end
59
+
60
+ filter = Array(options[:exclude_stacks])
61
+ return stacks.reject { |stack_name| filter.include? stack_name }
43
62
 
44
- filter = Array(stack_groups[options[:stack_group]] || options[:stacks])
63
+ else
64
+ # if no filter is specified, return the entire deck
65
+ return stacks
45
66
 
46
- # if no filter is specified, return the entire deck
47
- return stacks if filter.empty?
48
- filter.reduce({}) do |result, stack_name|
49
- result.merge(stack_name => @cloudfile.stacks[stack_name])
50
67
  end
51
68
  end
52
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk