enviroblyd 0.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/enviroblyd/cli/main.rb +7 -3
- data/lib/enviroblyd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4662a74b3e3eb17cad2ef6c6f511fc79e4460eb9a40635a8f476e50076b075e7
|
4
|
+
data.tar.gz: 4fba6adca14dd3247decf29333e6452e544c91b9772012c494c1e452cdee74ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea39b7b42bdd486e064ef256524fcb5ca42030bcc3a91d51382436b0f5c035c8da438cc4d5f094aec714319429df255dc717fb74b7240e44cb051d86bd2e987
|
7
|
+
data.tar.gz: eeb5ea402402c421d298da8dd2e641fa8c0c46e39dfd5e27abffe89752aa180df8c5a965461d337ca097446486a27f47e25a265b48142df9018245d7cd43f4cf
|
data/lib/enviroblyd/cli/main.rb
CHANGED
@@ -9,13 +9,17 @@ class Enviroblyd::Cli::Main < Enviroblyd::Base
|
|
9
9
|
end
|
10
10
|
|
11
11
|
TOKEN_TTL_SECONDS = 30
|
12
|
-
IMDS_HOST = ENV.fetch("ENVIROBLYD_IMDS_HOST", "
|
12
|
+
IMDS_HOST = ENV.fetch("ENVIROBLYD_IMDS_HOST", "169.254.169.254")
|
13
13
|
API_HOST = ENV.fetch("ENVIROBLYD_API_HOST", "envirobly.com")
|
14
14
|
desc "boot", "Get IMDSv2 metadata"
|
15
15
|
def boot
|
16
|
-
token = http("http://#{IMDS_HOST}/latest/api/token"
|
16
|
+
token = http("http://#{IMDS_HOST}/latest/api/token",
|
17
|
+
type: Net::HTTP::Put, headers: { "X-aws-ec2-metadata-token-ttl-seconds" => TOKEN_TTL_SECONDS.to_s }).
|
18
|
+
body.chomp("")
|
17
19
|
puts "token: #{token} ."
|
18
|
-
instance_id = http("http://#{IMDS_HOST}/latest/meta-data/instance-id"
|
20
|
+
instance_id = http("http://#{IMDS_HOST}/latest/meta-data/instance-id",
|
21
|
+
headers: { "X-aws-ec2-metadata-token" => token }).
|
22
|
+
body.chomp("")
|
19
23
|
puts "instance_id: #{instance_id} ."
|
20
24
|
|
21
25
|
response = http("https://#{API_HOST}/api/v1/boots/#{instance_id}", retry_interval: 3, retries: 5, backoff: :exponential)
|
data/lib/enviroblyd/version.rb
CHANGED