opsworks-cli 0.3.4 → 0.3.5

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: 068100324156cfac2d98f7ac4121e6839f667488
4
- data.tar.gz: a2b80924cbd8a9e716fd6dbdee0424045734a009
3
+ metadata.gz: 61ce9cc1bf75c7a559b0adb4a905ef560706df8a
4
+ data.tar.gz: 3411f737526fc1212a710a0a63eba9842065c244
5
5
  SHA512:
6
- metadata.gz: 1650fcd952c0313cff7b82504889ecf5356694c1af528596cb6a6ee8d8befef4abd6c0c30b7c42f758cc4e885877a86481093923fe7c22bd00cb892a80159947
7
- data.tar.gz: c90d208c0729a2c9d0d8144e6f28b726de108f14ff3a10230baf5910a8e984a8fb2748083d29538158946359cd46c8d0c449ce09197ea5b68f37742ab3642193
6
+ metadata.gz: f7111a5b4d35f7f402b427ac916b7de4d75073667b62286de98ff1317adb6d9cd26d67165cd8a895dadacf06d6ce154a2bc5a5d82e97e4e98a96fdafc71ecae6
7
+ data.tar.gz: c0d2f3e0431d8bd6a2fbcba477508f3696f88c0b189bcd42d1be00e60c48120224e93cda35621d5c664f6edd65cfef86dc5a0d2156ba311b83128f020d5df008
data/README.md CHANGED
@@ -19,13 +19,7 @@ The gem expects to have access to your AWS access key ID and secret access key.
19
19
  export AWS_ACCESS_KEY_ID=...
20
20
  export AWS_SECRET_ACCESS_KEY=...
21
21
 
22
- If you're on OS X, you may also use the [aws-keychain-util](https://github.com/zwily/aws-keychain-util) to password-protect these credentials within the OS X Keychain. To do this, follow the instructions in the gem's README:
23
-
24
- gem install aws-keychain-util
25
- aws-creds init
26
- aws-creds add
27
-
28
- When you add credentials, make sure to name the account `default`.
22
+ Second (the preferred option), you may use the [Omnivault](https://github.com/aptible/omnivault) gem to store and configure your credentials automatically, via your choice of password-protected vault (Apple Keychain or pws).
29
23
 
30
24
  ## Usage
31
25
 
@@ -1,7 +1,7 @@
1
1
  require 'thor'
2
2
  require 'aws'
3
3
 
4
- require_relative 'helpers/keychain'
4
+ require_relative 'helpers/credentials'
5
5
  require_relative 'helpers/options'
6
6
 
7
7
  require_relative 'subcommands/update'
@@ -16,6 +16,9 @@ module OpsWorks
16
16
  class Agent < Thor
17
17
  include Thor::Actions
18
18
 
19
+ include Helpers::Credentials
20
+ include Helpers::Options
21
+
19
22
  include Subcommands::Update
20
23
  include Subcommands::UpgradeChef
21
24
  include Subcommands::Recipes
@@ -0,0 +1,18 @@
1
+ require 'omnivault'
2
+
3
+ module OpsWorks
4
+ module CLI
5
+ module Helpers
6
+ module Credentials
7
+ def fetch_credentials
8
+ vault = Omnivault.autodetect
9
+ vault.configure_aws!
10
+ end
11
+
12
+ def env_credentials?
13
+ !!(ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'])
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -13,7 +13,7 @@ module OpsWorks
13
13
  option :stack, type: :array
14
14
  option :timeout, type: :numeric, default: 300
15
15
  define_method 'apps:deploy' do |name|
16
- fetch_keychain_credentials unless env_credentials?
16
+ fetch_credentials unless env_credentials?
17
17
  stacks = parse_stacks(options.merge(active: true))
18
18
  deployments = stacks.map do |stack|
19
19
  next unless (app = stack.find_app_by_name(name))
@@ -35,7 +35,7 @@ module OpsWorks
35
35
  'Display the most recent deployment of an app'
36
36
  option :stack, type: :array
37
37
  define_method 'apps:status' do |name|
38
- fetch_keychain_credentials unless env_credentials?
38
+ fetch_credentials unless env_credentials?
39
39
 
40
40
  table = parse_stacks(options).map do |stack|
41
41
  next unless (app = stack.find_app_by_name(name))
@@ -64,7 +64,7 @@ module OpsWorks
64
64
 
65
65
  fail 'Git URL not yet supported' if options[:git_url]
66
66
 
67
- fetch_keychain_credentials unless env_credentials?
67
+ fetch_credentials unless env_credentials?
68
68
  stacks = parse_stacks(options)
69
69
 
70
70
  stacks.each do |stack|
@@ -9,13 +9,10 @@ module OpsWorks
9
9
  # rubocop:disable CyclomaticComplexity
10
10
  def self.included(thor)
11
11
  thor.class_eval do
12
- include Helpers::Keychain
13
- include Helpers::Options
14
-
15
12
  desc 'config:get KEY [--stack STACK]', 'Get a single config value'
16
13
  option :stack, type: :array
17
14
  define_method 'config:get' do |key|
18
- fetch_keychain_credentials unless env_credentials?
15
+ fetch_credentials unless env_credentials?
19
16
  table = parse_stacks(options).map do |stack|
20
17
  value = stack.custom_json_at(key)
21
18
  [stack.name, value || '(null)']
@@ -28,7 +25,7 @@ module OpsWorks
28
25
  desc 'config:set KEY VALUE [--stack STACK]', 'Set a config value'
29
26
  option :stack, type: :array
30
27
  define_method 'config:set' do |key, value|
31
- fetch_keychain_credentials unless env_credentials?
28
+ fetch_credentials unless env_credentials?
32
29
  parse_stacks(options).each do |stack|
33
30
  say "Updating #{stack.name}..."
34
31
  stack.set_custom_json_at(key, value)
@@ -38,7 +35,7 @@ module OpsWorks
38
35
  desc 'config:unset KEY [--stack STACK]', 'Unset a config value'
39
36
  option :stack, type: :array
40
37
  define_method 'config:unset' do |key|
41
- fetch_keychain_credentials unless env_credentials?
38
+ fetch_credentials unless env_credentials?
42
39
  parse_stacks(options).map do |stack|
43
40
  say "Updating #{stack.name}..."
44
41
  stack.set_custom_json_at(key, nil)
@@ -14,7 +14,7 @@ module OpsWorks
14
14
  option :ssh, type: :boolean, default: true
15
15
  option :sudo, type: :boolean, default: true
16
16
  define_method 'iam:allow' do |user|
17
- fetch_keychain_credentials unless env_credentials?
17
+ fetch_credentials unless env_credentials?
18
18
  stacks = parse_stacks(options.merge(active: true))
19
19
  stacks.each do |stack|
20
20
  permission = stack.find_permission_by_user(user)
@@ -27,7 +27,7 @@ module OpsWorks
27
27
  desc 'iam:lockdown [--stack STACK]', 'Remove all stack permissions'
28
28
  option :stack, type: :array
29
29
  define_method 'iam:lockdown' do
30
- fetch_keychain_credentials unless env_credentials?
30
+ fetch_credentials unless env_credentials?
31
31
  stacks = parse_stacks(options.merge(active: true))
32
32
  stacks.each do |stack|
33
33
  say "Locking down #{stack.name}..."
@@ -12,7 +12,7 @@ module OpsWorks
12
12
  option :stack, type: :array
13
13
  option :timeout, type: :numeric, default: 300
14
14
  define_method 'recipes:run' do |recipe|
15
- fetch_keychain_credentials unless env_credentials?
15
+ fetch_credentials unless env_credentials?
16
16
  stacks = parse_stacks(options.merge(active: true))
17
17
  deployments = stacks.map do |stack|
18
18
  say "Executing recipe on #{stack.name}..."
@@ -32,7 +32,7 @@ module OpsWorks
32
32
  'Add a recipe to a given layer and lifecycle event'
33
33
  option :stack, type: :array
34
34
  define_method 'recipes:add' do |layername, event, recipe|
35
- fetch_keychain_credentials unless env_credentials?
35
+ fetch_credentials unless env_credentials?
36
36
  stacks = parse_stacks(options)
37
37
  stacks.each do |stack|
38
38
  layer = stack.layers.find { |l| l.shortname == layername }
@@ -9,14 +9,11 @@ module OpsWorks
9
9
  # rubocop:disable CyclomaticComplexity
10
10
  def self.included(thor)
11
11
  thor.class_eval do
12
- include Helpers::Keychain
13
- include Helpers::Options
14
-
15
12
  desc 'update [--stack STACK]', 'Update OpsWorks custom cookbooks'
16
13
  option :stack, type: :array
17
14
  option :timeout, type: :numeric, default: 300
18
15
  def update
19
- fetch_keychain_credentials unless env_credentials?
16
+ fetch_credentials unless env_credentials?
20
17
  stacks = parse_stacks(options.merge(active: true))
21
18
  deployments = stacks.map do |stack|
22
19
  say "Updating #{stack.name}..."
@@ -9,15 +9,12 @@ module OpsWorks
9
9
  # rubocop:disable CyclomaticComplexity
10
10
  def self.included(thor)
11
11
  thor.class_eval do
12
- include Helpers::Keychain
13
- include Helpers::Options
14
-
15
12
  desc 'upgrade-chef [--stack STACK]', 'Upgrade Chef version'
16
13
  option :stack, type: :array
17
14
  option :version
18
15
  option :manage_berkshelf, type: :boolean, default: false
19
16
  def upgrade_chef
20
- fetch_keychain_credentials unless env_credentials?
17
+ fetch_credentials unless env_credentials?
21
18
  stacks = parse_stacks(options.merge(active: true))
22
19
  version = OpsWorks::Stack.latest_chef_version
23
20
  stacks.each do |stack|
@@ -1,5 +1,5 @@
1
1
  module OpsWorks
2
2
  module CLI
3
- VERSION = '0.3.4'
3
+ VERSION = '0.3.5'
4
4
  end
5
5
  end
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'aws-sdk', '~> 1.64'
25
25
  spec.add_dependency 'jsonpath'
26
26
  spec.add_dependency 'activesupport'
27
+ spec.add_dependency 'omnivault'
27
28
 
28
- spec.add_development_dependency 'aws-keychain-util'
29
29
  spec.add_development_dependency 'bundler', '~> 1.5'
30
30
  spec.add_development_dependency 'aptible-tasks'
31
31
  spec.add_development_dependency 'rake'
@@ -5,19 +5,13 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
5
  require 'opsworks/cli'
6
6
 
7
7
  require 'fabrication'
8
+ require 'omnivault'
8
9
 
9
10
  RSpec.configure do |config|
10
11
  config.before do
11
12
  allow(AWS::OpsWorks::Client).to receive(:new) { double.as_null_object }
12
13
  allow(AWS).to receive(:config)
13
14
 
14
- begin
15
- require 'aws-keychain-util/credential_provider'
16
- allow(AwsKeychainUtil::CredentialProvider).to receive(:new) do
17
- double.as_null_object
18
- end
19
- rescue LoadError
20
- nil
21
- end
15
+ allow(Omnivault).to receive(:autodetect) { double.as_null_object }
22
16
  end
23
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsworks-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -67,13 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: aws-keychain-util
70
+ name: omnivault
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
- type: :development
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -183,7 +183,7 @@ files:
183
183
  - lib/opsworks/app.rb
184
184
  - lib/opsworks/cli.rb
185
185
  - lib/opsworks/cli/agent.rb
186
- - lib/opsworks/cli/helpers/keychain.rb
186
+ - lib/opsworks/cli/helpers/credentials.rb
187
187
  - lib/opsworks/cli/helpers/options.rb
188
188
  - lib/opsworks/cli/subcommands/apps.rb
189
189
  - lib/opsworks/cli/subcommands/config.rb
@@ -1,25 +0,0 @@
1
- module OpsWorks
2
- module CLI
3
- module Helpers
4
- module Keychain
5
- KEYCHAIN = 'aws'
6
-
7
- def fetch_keychain_credentials(account = 'default')
8
- require 'aws-keychain-util/credential_provider'
9
-
10
- provider = AwsKeychainUtil::CredentialProvider.new(
11
- account, KEYCHAIN
12
- )
13
- AWS.config(credential_provider: provider) if provider.set?
14
- rescue LoadError
15
- # Keychain utility is optional and only relevant on OS X
16
- nil
17
- end
18
-
19
- def env_credentials?
20
- !!(ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'])
21
- end
22
- end
23
- end
24
- end
25
- end