opsworks 0.0.10 → 0.0.12

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: 4e2abd2db629ce47b3e1fe9c08b8a81c2b46859d
4
- data.tar.gz: bbe7ec9cb249c43a936d9a8e8e919a08e93116ef
3
+ metadata.gz: d9a072f70453115aecb14dd6d89b06a53d0755a5
4
+ data.tar.gz: 51816691809d075b6147c008e2351baeae4f90ba
5
5
  SHA512:
6
- metadata.gz: 33e6ec81157adb41dd4195a77a26e5cef41b664e0d463dfcc34794e357a8871191eb00c621a97c1c9727ed60ed263a4bd7eb6957b957e6b930a86e4eb7d28424
7
- data.tar.gz: a8bfa2a2984dc44fb543fe8728b42636b3579582519a4236f831420c578136d4a6b44cb5fe3e63137368cfeb2eceeee17bbec84f267c03b6d567d0e3389bdaf8
6
+ metadata.gz: 8b2898d9b42baee528e1f511a8a8b53eac310808abb14b5981e371f4a0e3d3abc43b91ade936c13200eee4f499ecd8cf165210e10f34244b94289ccbf081b702
7
+ data.tar.gz: 64a66e102bba8012f132bf6364b1c50249e185b0f1bbbe2e51f9816346cda185963eabbd6511d427604d81174b0743fe638f53ac57deb59270827d7fe32d8ee7
data/README.md CHANGED
@@ -6,26 +6,37 @@ Command line interface for Amazon OpsWorks.
6
6
 
7
7
  Run `opsworks` with one of the following commands:
8
8
 
9
- * `ssh` Generate and update SSH configuration files
9
+ * `ssh` Generate and update SSH configuration files.
10
+
11
+ Instances are added in stack order to the SSH configuration. If you have
12
+ instances with the same name in multiple stacks, the one from the first
13
+ stack will be used by SSH.
10
14
 
11
15
  ## Configuration
12
16
 
13
- This gem uses the same configuration file as the [AWS CLI][aws_cli]
17
+ This gem uses the same configuration file as the [AWS CLI][aws_cli]. This
18
+ requires you to have a working AWS CLI setup before continuing.
14
19
 
15
20
  Add the following section to the file pointed out by the `AWS_CONFIG_FILE`
16
21
  environment variable:
17
22
 
18
23
  [opsworks]
19
- stack-id=<MY STACK ID>
20
- ssh-user=<MY SSH USER NAME>
24
+ stack-id=<MY STACK IDs>
25
+ ssh-user-name=<MY SSH USER NAME>
26
+
27
+ The stack ID can be found in the stack settings, under _OpsWorks ID_ (or in the
28
+ address bar of your browser as
29
+ `console.aws.amazon.com/opsworks/home?#/stack/<STACK_ID>/stack`). You can add
30
+ several stack IDs belonging to the same IAM account separated by commas
31
+ (`stack-id=STACK1,...,STACKN`).
21
32
 
22
- The stack ID can be found in the stack settings, under _OpsWorks ID_. The
23
- `ssh-user` flag should be set to the username you want to use when logging in
24
- remotely, most probably the user name from your _My Settings_ page on OpsWorks.
33
+ The `ssh-user-name` value should be set to the username you want to use when
34
+ logging in remotely, most probably the user name from your _My Settings_ page
35
+ on OpsWorks.
25
36
 
26
37
  ## Installation
27
38
 
28
- Install for use on the command line:
39
+ Install for use on the command line (requires Ruby and Rubygems):
29
40
 
30
41
  $ gem install opsworks
31
42
 
@@ -49,4 +60,4 @@ And then execute:
49
60
  4. Push to the branch (`git push origin my-new-feature`)
50
61
  5. Create new Pull Request
51
62
 
52
- [aws_cli]: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html "Amazon AWS CLI"
63
+ [aws_cli]: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html "Amazon AWS CLI"
@@ -5,7 +5,7 @@ class OpsWorks::CLI
5
5
  def self.start
6
6
  commands = %w(ssh)
7
7
 
8
- global_opts = Trollop::options do
8
+ Trollop::options do
9
9
  version "opsworks #{OpsWorks::VERSION} " <<
10
10
  "(c) #{OpsWorks::AUTHORS.join(", ")}"
11
11
  banner <<-EOS.unindent
@@ -25,7 +25,7 @@ class OpsWorks::CLI
25
25
  end
26
26
 
27
27
  command = ARGV.shift
28
- command_opts = case command
28
+ case command
29
29
  when "ssh"
30
30
  OpsWorks::Commands::SSH.run
31
31
  when nil
@@ -1,5 +1,4 @@
1
1
  require 'aws-sdk'
2
- require 'awesome_print'
3
2
  require 'trollop'
4
3
 
5
4
  require 'opsworks'
@@ -32,8 +31,12 @@ module OpsWorks::Commands
32
31
 
33
32
  client = AWS::OpsWorks::Client.new
34
33
 
35
- result = client.describe_instances(stack_id: config.stack_id)
36
- instances = result.instances.select { |i| i[:status] != "stopped" }
34
+ instances = []
35
+
36
+ config.stacks.each do |stack_id|
37
+ result = client.describe_instances(stack_id: stack_id)
38
+ instances += result.instances.select { |i| i[:status] != "stopped" }
39
+ end
37
40
 
38
41
  instances.map! do |instance|
39
42
  ip = instance[:elastic_ip] || instance[:public_ip]
@@ -6,7 +6,7 @@ module OpsWorks
6
6
  end
7
7
 
8
8
  class Config
9
- attr_reader :stack_id, :ssh_user_name
9
+ attr_reader :stacks, :ssh_user_name
10
10
 
11
11
  def initialize
12
12
  ini = IniFile.load(ENV["AWS_CONFIG_FILE"])
@@ -17,8 +17,8 @@ module OpsWorks
17
17
  secret_access_key: aws_config["aws_secret_access_key"],
18
18
  )
19
19
 
20
- @stack_id = ini['opsworks']['stack-id']
21
- @ssh_user_name = ini['opsworks']['ssh-user-name']
20
+ @stacks = ini['opsworks']['stack-id'].split(',').map(&:strip)
21
+ @ssh_user_name = ini['opsworks']['ssh-user-name'].strip
22
22
  end
23
23
  end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module OpsWorks
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
3
3
  AUTHORS = ["Adam Lindberg"]
4
4
  EMAIL = ["hello@alind.io"]
5
5
  DESCRIPTION = "Amazon OpsWorks CLI"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Lindberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-02 00:00:00.000000000 Z
11
+ date: 2013-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.0.3
137
+ rubygems_version: 2.0.6
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Command line interface for Amazon OpsWorks