specinfra 2.89.0 → 2.90.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/ec2_metadata.rb +14 -2
- data/lib/specinfra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 067d190ae11b7f8fe5c498d4ff1ede90d0fb31a61433949aa36bc15451694385
|
4
|
+
data.tar.gz: 5c9e782c260030df5eab0731ce69ee76d6282992706ba9babd3b20f92a6437f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb85dc153cb2b1f09e7cc3fa3a2e08ddb0512814df16b5ef74a644a76ede812667ca2f9dbcaae54d5f1e271d185b3f31ab36647d0cbad3d4cf238184b271cdf2
|
7
|
+
data.tar.gz: 8b149adf18beb0647e019580851ba742698593db56ae8e671a858f6310ef9cd6febe4225b7a11a880a8dadd97c67abe5954dc59238da7b532b065dcdab242aa3
|
@@ -5,10 +5,13 @@ module Specinfra
|
|
5
5
|
@host_inventory = host_inventory
|
6
6
|
|
7
7
|
@base_uri = 'http://169.254.169.254/latest/meta-data/'
|
8
|
+
@token_uri = 'http://169.254.169.254/latest/api/token'
|
9
|
+
@token = ''
|
8
10
|
@metadata = {}
|
9
11
|
end
|
10
12
|
|
11
13
|
def get
|
14
|
+
@token = get_token
|
12
15
|
@metadata = get_metadata
|
13
16
|
self
|
14
17
|
end
|
@@ -64,7 +67,7 @@ module Specinfra
|
|
64
67
|
def get_metadata(path='')
|
65
68
|
metadata = {}
|
66
69
|
|
67
|
-
keys = @host_inventory.backend.run_command("curl -s #{@base_uri}#{path}").stdout.split("\n")
|
70
|
+
keys = @host_inventory.backend.run_command("curl -H \"X-aws-ec2-metadata-token: #{@token}\" -s #{@base_uri}#{path}").stdout.split("\n")
|
68
71
|
|
69
72
|
keys.each do |key|
|
70
73
|
if key =~ %r{/$}
|
@@ -84,7 +87,16 @@ module Specinfra
|
|
84
87
|
end
|
85
88
|
|
86
89
|
def get_endpoint(path)
|
87
|
-
ret = @host_inventory.backend.run_command("curl -s #{@base_uri}#{path}")
|
90
|
+
ret = @host_inventory.backend.run_command("curl -H \"X-aws-ec2-metadata-token: #{@token}\" -s #{@base_uri}#{path}")
|
91
|
+
if ret.success?
|
92
|
+
ret.stdout
|
93
|
+
else
|
94
|
+
nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def get_token
|
99
|
+
ret = @host_inventory.backend.run_command("curl -X PUT -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\" -s #{@token_uri}")
|
88
100
|
if ret.success?
|
89
101
|
ret.stdout
|
90
102
|
else
|
data/lib/specinfra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.90.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|