asger 0.2.0 → 0.2.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
  SHA1:
3
- metadata.gz: 1d7e123884650c6770de89781c7fb27cd17106c1
4
- data.tar.gz: 85913ef76261482b872a1d87ec892c6869bbc212
3
+ metadata.gz: abc4ad19cb57955e168d9f3c1931eec3ba3f4835
4
+ data.tar.gz: d9c71640218a1819c020207e04b962be00875325
5
5
  SHA512:
6
- metadata.gz: ddee73b770fb2fc1b69b59f5e89d230ec95d135264dd697920f453756dfd0e883a69d02f25eb477905538a424a9d99ca12edcf67a1b9ca2d2a07bfa286b4e99b
7
- data.tar.gz: f0ac3696d8f16ece760f270a9cf0d5a9ba887f58bfc20218fff238562ed58ed648c81c09b9d2a454e4c379a23cafd6b67c2c835885e4e150f37f8a66f7986384
6
+ metadata.gz: f08683fa0fdaff1e6ab811d79d46dc855b6817063815748b1889a3dd28f404341e1089f8a0c5d7056867355a598807c649845aa19a2c39c1640ee210f1263886
7
+ data.tar.gz: 58804ae9a19d5e4edab5b77fba9fa9aaf6057b57bc63fe59ca1b507b3c17db433aff00a3df7667ea14f43c20247e5235498fbfa20eee10f7cd1ed2456f212387
data/README.md CHANGED
@@ -15,7 +15,8 @@
15
15
  Sample usage:
16
16
 
17
17
  ```bash
18
- ./bin/asger --queue-url 'https://sqs.us-east-1.amazonaws.com/ACCOUNT_ID/QUEUE_NAME' --shared-credentials=CREDS --parameter-file /tmp/some_params.yaml --task-file %/echo.rb --task-file %/chef_deregister.rb
18
+ gem install asger
19
+ asger --queue-url 'https://sqs.us-east-1.amazonaws.com/ACCOUNT_ID/QUEUE_NAME' --shared-credentials=CREDS --parameter-file /tmp/some_params.yaml --task-file %/echo.rb --task-file %/chef_deregister.rb
19
20
  ```
20
21
 
21
22
  (Note: `%` is a special path character when passed to `--task-file`; it refers to the `stock_scripts` directory within the gem, so you can get started right away with the stock scripts.)
data/lib/asger/cli.rb CHANGED
@@ -30,6 +30,7 @@ module Asger
30
30
  opt :aws_logging, "Provides the Asger logger to AWS (use for deep debugging).", :default => false
31
31
 
32
32
  opt :shared_credentials, "Tells Asger to use shared credentials from '~/.aws/credentials'.", :type => :string
33
+ opt :iam, "Tells Asger to use IAM credentials.", :default => false
33
34
  end
34
35
 
35
36
  logger = Logger.new($stderr)
@@ -41,6 +42,11 @@ module Asger
41
42
  logger.error "--queue-url is required."
42
43
  exit(1)
43
44
  end
45
+ if opts[:shared_credentials] && opts[:iam]
46
+ logger.error "Only one of --shared-credentials and --iam can be used at a time."
47
+ exit(1)
48
+ end
49
+
44
50
  logger.warn "No tasks configured; Asger will run, but won't do much." unless (opts[:task_file] && !opts[:task_file].empty?)
45
51
 
46
52
  param_files =
@@ -59,11 +65,15 @@ module Asger
59
65
  parameters = {}
60
66
  param_files.each { |p| parameters.deep_merge!(p) }
61
67
 
62
- credentials = nil
63
- if opts[:shared_credentials]
64
- logger.info "Using shared credentials '#{opts[:shared_credentials]}'."
65
- credentials = Aws::SharedCredentials.new(profile_name: opts[:shared_credentials])
66
- end
68
+ credentials =
69
+ if opts[:shared_credentials]
70
+ logger.info "Using shared credentials '#{opts[:shared_credentials]}'."
71
+ Aws::SharedCredentials.new(profile_name: opts[:shared_credentials])
72
+ elsif opts[:iam]
73
+ Aws::InstanceProfileCredentials.new
74
+ else
75
+ raise "No credentials found. Use --shared-credentials or --iam."
76
+ end
67
77
 
68
78
  aws_logger = opts[:aws_logging] ? logger : nil
69
79
  sqs_client = Aws::SQS::Client.new(logger: aws_logger, credentials: credentials)
data/lib/asger/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Asger
2
2
  # The current version of Asger.
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Ropple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.2.2
155
+ rubygems_version: 2.4.5
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: A persistent daemon that watches an AWS autoscaling group for changes and