stack_master 2.13.0 → 2.13.1

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: 8c0add9f29f6f809207e0b64969e084172dc194c77ae1636ceb073000e8020b4
4
- data.tar.gz: f5e2a4a3a84a55a74bc29525067691a847f24b9c4256108d3ec9c086cd82ab6a
3
+ metadata.gz: 9c003a9755154a92dc52a3ed8c4e834caf66eb92c520ca8b695be7661ab47404
4
+ data.tar.gz: 5a3b2c9e0afef8120f6fcc0df4041ef003b1e42e86c0584a33148a4ec1ef74be
5
5
  SHA512:
6
- metadata.gz: addcb8147d827d7f403018c72a44a4fb1ca1d5536e7d74abe0c32e3645c1eded4278c761d7bb48d861e2857d7cd64ae9e61d69fb70d560f1aa44b79672ccc178
7
- data.tar.gz: 98d47ddfcc3e928f55d7946d50f4bab280c04bb4d0eb0b8aade5616c1274ab542755ef616fdec3ccacce739832300bf202ba84e2d22e213f11f9ba62b91b349d
6
+ metadata.gz: 58df6d821a3048a1edda08a3bf63407093b4a942d185491e4d686f74fea0718c2973790aaf8d8e4c5f609b58bedd25a8dcf601d58d92a3be5b3d90e859477c9e
7
+ data.tar.gz: b54493fb2e7b2ec35bb2abfa88da2dde6cfc16e3187037a890031760b5bab136848680a6a1d22a9ee101a2a0ae47cac6d8a3677519da3b6bc996208aa4006478
@@ -7,7 +7,7 @@ module StackMaster
7
7
 
8
8
  def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
9
9
  @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
10
- Commander::Runner.instance_variable_set('@singleton', Commander::Runner.new(argv))
10
+ Commander::Runner.instance_variable_set('@instance', Commander::Runner.new(argv))
11
11
  StackMaster.stdout = @stdout
12
12
  StackMaster.stderr = @stderr
13
13
  TablePrint::Config.io = StackMaster.stdout
@@ -1,12 +1,17 @@
1
1
  module StackMaster
2
2
  class Identity
3
+ AllowedAccountAliasesError = Class.new(StandardError)
3
4
  MissingIamPermissionsError = Class.new(StandardError)
4
5
 
5
6
  def running_in_account?(accounts)
6
- accounts.nil? ||
7
- accounts.empty? ||
8
- contains_account_id?(accounts) ||
9
- contains_account_alias?(accounts)
7
+ return true if accounts.nil? || accounts.empty? || contains_account_id?(accounts)
8
+
9
+ # skip alias check (which makes an API call) if all values are account IDs
10
+ return false if accounts.all? { |account| account_id?(account) }
11
+
12
+ contains_account_alias?(accounts)
13
+ rescue MissingIamPermissionsError
14
+ raise AllowedAccountAliasesError, 'Failed to validate whether the current AWS account is allowed'
10
15
  end
11
16
 
12
17
  def account
@@ -40,5 +45,11 @@ module StackMaster
40
45
  def contains_account_alias?(aliases)
41
46
  account_aliases.any? { |account_alias| aliases.include?(account_alias) }
42
47
  end
48
+
49
+ def account_id?(id_or_alias)
50
+ # While it's not explicitly documented as prohibited, it cannot (currently) be possible to set an account alias of
51
+ # 12 digits, as that could cause one console sign-in URL to resolve to two separate accounts.
52
+ /^[0-9]{12}$/.match?(id_or_alias)
53
+ end
43
54
  end
44
55
  end
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "2.13.0"
2
+ VERSION = "2.13.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-10 00:00:00.000000000 Z
12
+ date: 2021-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -143,7 +143,7 @@ dependencies:
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 4.5.2
146
+ version: 4.6.0
147
147
  - - "<"
148
148
  - !ruby/object:Gem::Version
149
149
  version: '5'
@@ -153,7 +153,7 @@ dependencies:
153
153
  requirements:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
- version: 4.5.2
156
+ version: 4.6.0
157
157
  - - "<"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '5'
@@ -563,8 +563,8 @@ licenses:
563
563
  metadata:
564
564
  bug_tracker_uri: https://github.com/envato/stack_master/issues
565
565
  changelog_uri: https://github.com/envato/stack_master/blob/master/CHANGELOG.md
566
- documentation_uri: https://www.rubydoc.info/gems/stack_master/2.13.0
567
- source_code_uri: https://github.com/envato/stack_master/tree/v2.13.0
566
+ documentation_uri: https://www.rubydoc.info/gems/stack_master/2.13.1
567
+ source_code_uri: https://github.com/envato/stack_master/tree/v2.13.1
568
568
  post_install_message:
569
569
  rdoc_options: []
570
570
  require_paths:
@@ -580,7 +580,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
580
580
  - !ruby/object:Gem::Version
581
581
  version: '0'
582
582
  requirements: []
583
- rubygems_version: 3.2.8
583
+ rubygems_version: 3.0.4
584
584
  signing_key:
585
585
  specification_version: 4
586
586
  summary: StackMaster is a sure-footed way of creating, updating and keeping track