aws_ssh 0.1.1 → 0.1.2

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: 14171af4055f9cec7390e3b1b0a63e3554fc173f
4
- data.tar.gz: 1da138031a9c079484ae282bf35046c4e18b048a
3
+ metadata.gz: a29fb3972592fe9a5515f6b0980977736c7b150e
4
+ data.tar.gz: 13272a3858270e3a3daeabac3c7c2b82846d544f
5
5
  SHA512:
6
- metadata.gz: 83dd28ff9fcae85abd860ac20f89fb21e0c2f0a0fda3b0579c3d3ecb90cfd0f052afb8135ae84e5c431dcc25a38287f156f8ac68afb21990124f0a36d59125f7
7
- data.tar.gz: ecb116933c9dafbdb88898aeaaaace8b4cb5becfed2ce7af45c36e9a3ebc139483e95e1dff3a1b6b9ea63427ea3a219eb176aa977075a14133ca3b5a351d9293
6
+ metadata.gz: e942774c61463151f57ee62eb45d4c4414047b4b5caeb797792ac9845d9cdf5a2dddf356ac79277213d33f853d1d4ac87bbc83e0c45ea0d54c85e1be8b357ea7
7
+ data.tar.gz: c724c62b75f28e1557fcef2ceaebc7b615f448afbca89e57607d90cf7e425f738ace9e4467ec66c0d41d11ce48883dcecc7bb7cd91da7ad623d378add763f309
@@ -0,0 +1,4 @@
1
+ module AWS_SSH
2
+ #24 hours
3
+ CACHE_TIME = (60*60)*24
4
+ end
data/lib/aws_ssh/ec2.rb CHANGED
@@ -55,7 +55,7 @@ module AWS_SSH
55
55
  tags = instance.tags.to_h
56
56
  key_file = nil
57
57
  base = ENV['HOME']+"/.ssh/"+instance.key_name
58
- @ssh_key_suffixes.each{|k| if File.exists?(base+k) then key_file = base+k end }
58
+ @ssh_key_suffixes.each{|k| if key_file.nil? && File.exists?(base+k) then key_file = base+k end }
59
59
  return {
60
60
  :name => if tags["Name"].nil? then nil else tags["Name"].to_s.strip end,
61
61
  :user => if tags["user"].nil? then @User else tags["user"].to_s.strip end,
@@ -1,11 +1,13 @@
1
1
  require "aws_ssh/files"
2
+ require "aws_ssh/cache"
2
3
  module AWS_SSH
3
4
  class Run
4
5
  def generate
5
- config = AWS_SSH::HOSTS_FILE
6
+ config = ENV['HOME']+"/.ssh/"+AWS_SSH::HOSTS_FILE
6
7
  # 4 hour cache
7
- if (File.exists?(config) && File.mtime(config) < (Time.now - (60*60*4) )) || ! File.exists?(config)
8
+ if (File.exists?(config) && File.mtime(config) < (Time.now - (AWS_SSH::CACHE_TIME) )) || ! File.exists?(config)
8
9
  self.force
10
+ self.write
9
11
  end
10
12
  end
11
13
 
@@ -1,3 +1,3 @@
1
1
  module AWS_SSH
2
- VERSION="0.1.1"
2
+ VERSION="0.1.2"
3
3
  end
data/lib/aws_ssh.rb CHANGED
@@ -9,6 +9,6 @@ module AWS_SSH
9
9
  require "aws_ssh/ec2"
10
10
  require "aws_ssh/setup"
11
11
  require "aws_ssh/teardown"
12
+ require "aws_ssh/cache"
12
13
  require "aws_ssh/runner"
13
-
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Marshall
@@ -85,6 +85,7 @@ files:
85
85
  - bin/aws_ssh_setup
86
86
  - bin/aws_ssh_teardown
87
87
  - lib/aws_ssh.rb
88
+ - lib/aws_ssh/cache.rb
88
89
  - lib/aws_ssh/cmds.rb
89
90
  - lib/aws_ssh/ec2.rb
90
91
  - lib/aws_ssh/exceptions.rb