infra-ctrl 0.1.5 → 0.1.6

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: a20ea9fdca4060e35455bfd95e798aff5aebd88b
4
- data.tar.gz: f32042a097739689a8343c3c459897ecd2613bcd
3
+ metadata.gz: 61af13373a9219c1b84f2a2d74f50f901e138c2f
4
+ data.tar.gz: 494a698e36789034a631ae9fe79229fa03321672
5
5
  SHA512:
6
- metadata.gz: 2c4fd0cc3c814ff55ff494e81d4624e7def7f05e959fdab55ef445acbc010aaeed244e24df0b5b0e37efcdf9f8febf8df7d15f77310cde72122671c0f855f5e6
7
- data.tar.gz: b790b3efad626c62a362f18295cf957393bd9b2c6363a0b7ac66a70e2dec98d47676df0117a259951f9f678ad351800ae91f4c2f00d5ef19ef1964f5730d68ac
6
+ metadata.gz: 78b5125f1480b3cdb4fe148bec8a7282ac092e38ba15cb0d035c5dfaf7b221ec1fe40ea2d836ea4f3c2650dd14b2adb7654221918d0afe8ca6d7b349e7acf95d
7
+ data.tar.gz: f6e58b7da91de9652aa324db7053415697b52985529beb5d3eea9acf06808ecdc745ef9c477d93f1754a46c933c31cf53cb67278a4ff483b3adcfcde2951a442
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ctrl (0.1.0)
4
+ infra-ctrl (0.1.6)
5
5
  aws-sdk (~> 2)
6
6
  methadone (~> 1.9.2)
7
7
  virtus
@@ -93,7 +93,7 @@ PLATFORMS
93
93
  DEPENDENCIES
94
94
  aruba
95
95
  bundler (~> 1.12)
96
- ctrl!
96
+ infra-ctrl!
97
97
  pry
98
98
  rake (~> 10.0)
99
99
  rdoc
data/README.md CHANGED
@@ -1,36 +1,36 @@
1
1
  # Ctrl
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ctrl`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This is a simple gem to ease listing and sshing to instances in an AWS VPC.
6
4
 
7
5
  ## Installation
8
6
 
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'ctrl'
13
- ```
7
+ $ gem install infra-ctrl
14
8
 
15
- And then execute:
9
+ Add environment variables for AWS (direnv.net FTW):
16
10
 
17
- $ bundle
11
+ * AWS_DEFAULT_REGION
12
+ * AWS_SECRET_ACCESS_KEY
13
+ * AWS_ACCESS_KEY_ID
18
14
 
19
- Or install it yourself as:
15
+ As well as a couple for specifying the users to log in as when sshing to the nat and internal instances:
20
16
 
21
- $ gem install ctrl
17
+ * CTRL_SSH_USER
18
+ * CTRL_SSH_NAT_USER
22
19
 
23
- ## Usage
20
+ ## Notes
24
21
 
25
- TODO: Write usage instructions here
22
+ Assumptions about your infrastructure:
26
23
 
27
- ## Development
24
+ 1. Instances with public ips are connected to directly using the CTRL_SSH_USER
25
+ 2. Each instance has a tag:Environment
26
+ 3. VPC private instances use the same user to log in
27
+ 4. You have the necessary keys locally, and are fine forwarding your agent
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ ## Usage
30
30
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+ $ ctrl ls <env> <instance name>
32
+ $ ctrl ssh <env> <instance name>
32
33
 
33
34
  ## Contributing
34
35
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ctrl.
36
-
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MattHall/ctrl
@@ -5,7 +5,7 @@ require 'ctrl/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "infra-ctrl"
8
- spec.license=""
8
+ spec.license = "MIT"
9
9
  spec.version = Ctrl::VERSION
10
10
  spec.authors = ["Matt Hall"]
11
11
  spec.email = ["matt@codebeef.com"]
@@ -19,14 +19,13 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = ["ctrl"]
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "virtus"
23
- spec.add_dependency('methadone', '~> 1.9.2')
22
+ spec.add_dependency "virtus", '~> 1.0'
23
+ spec.add_dependency('methadone', '~> 1.9')
24
24
  spec.add_dependency('aws-sdk', '~> 2')
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.12"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
- spec.add_development_dependency('rdoc')
30
- spec.add_development_dependency('aruba')
31
- spec.add_development_dependency('pry')
29
+ spec.add_development_dependency('aruba', "~> 0.14")
30
+ spec.add_development_dependency('pry', "0.14")
32
31
  end
@@ -26,6 +26,7 @@ module Ctrl
26
26
  end
27
27
 
28
28
  def perform
29
+ return 'No instances found' if instances.empty?
29
30
  instances.size == 1 ? instances.first : selection
30
31
  end
31
32
  end
@@ -8,12 +8,12 @@ module Ctrl
8
8
  attribute :nat_instance
9
9
  attribute :target_instance
10
10
 
11
- def target_is_nat?
12
- nat_instance.instance_id == target_instance.instance_id
11
+ def target_is_public?
12
+ target_instance.public_ip_address.to_s != ""
13
13
  end
14
14
 
15
15
  def direct_cmd
16
- "ssh -A #{SSH_USER}@#{nat_instance.public_ip_address}"
16
+ "ssh -A #{SSH_USER}@#{target_instance.public_ip_address}"
17
17
  end
18
18
 
19
19
  def proxied_cmd
@@ -21,7 +21,7 @@ module Ctrl
21
21
  end
22
22
 
23
23
  def to_s
24
- return direct_cmd if target_is_nat?
24
+ return direct_cmd if target_is_public?
25
25
  proxied_cmd
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module Ctrl
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infra-ctrl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Hall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: methadone
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.9.2
33
+ version: '1.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.9.2
40
+ version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,48 +94,34 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
- - !ruby/object:Gem::Dependency
98
- name: rdoc
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: aruba
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - ">="
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '0'
103
+ version: '0.14'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - ">="
108
+ - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '0'
110
+ version: '0.14'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: pry
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - ">="
115
+ - - '='
130
116
  - !ruby/object:Gem::Version
131
- version: '0'
117
+ version: '0.14'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
- - - ">="
122
+ - - '='
137
123
  - !ruby/object:Gem::Version
138
- version: '0'
124
+ version: '0.14'
139
125
  description: Simple way to ls / ssh into vpns
140
126
  email:
141
127
  - matt@codebeef.com
@@ -149,7 +135,6 @@ files:
149
135
  - Gemfile
150
136
  - Gemfile.lock
151
137
  - README.md
152
- - README.rdoc
153
138
  - Rakefile
154
139
  - bin/console
155
140
  - bin/ctrl
@@ -165,7 +150,7 @@ files:
165
150
  - lib/ctrl/version.rb
166
151
  homepage: https://github.com/MattHall/ctrl
167
152
  licenses:
168
- - ''
153
+ - MIT
169
154
  metadata: {}
170
155
  post_install_message:
171
156
  rdoc_options: []
@@ -1,19 +0,0 @@
1
- = ctrl - DESCRIBE YOUR GEM
2
-
3
- Author:: YOUR NAME (YOUR EMAIL)
4
- Copyright:: Copyright (c) 2016 YOUR NAME
5
-
6
-
7
- DESCRIBE YOUR GEM HERE
8
-
9
- == Links
10
-
11
- * {Source on Github}[LINK TO GITHUB]
12
- * RDoc[LINK TO RDOC.INFO]
13
-
14
- == Install
15
-
16
- == Examples
17
-
18
- == Contributing
19
-