opsworks 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -9
- data/lib/opsworks/cli.rb +2 -2
- data/lib/opsworks/commands/ssh.rb +6 -3
- data/lib/opsworks/config.rb +3 -3
- data/lib/opsworks/meta.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9a072f70453115aecb14dd6d89b06a53d0755a5
|
4
|
+
data.tar.gz: 51816691809d075b6147c008e2351baeae4f90ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
23
|
-
|
24
|
-
|
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"
|
data/lib/opsworks/cli.rb
CHANGED
@@ -5,7 +5,7 @@ class OpsWorks::CLI
|
|
5
5
|
def self.start
|
6
6
|
commands = %w(ssh)
|
7
7
|
|
8
|
-
|
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
|
-
|
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
|
-
|
36
|
-
|
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]
|
data/lib/opsworks/config.rb
CHANGED
@@ -6,7 +6,7 @@ module OpsWorks
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class Config
|
9
|
-
attr_reader :
|
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
|
-
@
|
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
|
data/lib/opsworks/meta.rb
CHANGED
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.
|
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-
|
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.
|
137
|
+
rubygems_version: 2.0.6
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Command line interface for Amazon OpsWorks
|