azure_info 0.1.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/CHANGELOG.md +3 -0
- data/README.md +19 -2
- data/lib/azure_info.rb +4 -4
- data/lib/azure_info/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64fdf9124a081dfc9e90c33752a9306866babcfbfa969d1d6ae07acacd44533
|
4
|
+
data.tar.gz: fd3e22f714b79af5761095ae4202db4157f7e0d3a9815ea961304433d28830c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 820551163d07c69b52590ba94a8a43aa0f9d72acf9a8cb4cf7bfebeed4dd26f08d27296dd7c3e8bc87e07418f5c6cc590256fcd551ebb3643364225d88ff5901
|
7
|
+
data.tar.gz: 7850d0d6edefb3e143d324a27cd5fef69e0d1e9c2149be85a70da57fc7bb94a24baf540795caaeafa428872618e32e28afea2d8124e2d630f232f928a25bbcce
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.1.2] - 2021-04-15
|
7
|
+
- [#2](https://github.com/boltops-tools/azure_info/pull/2) consider env vars also
|
8
|
+
|
6
9
|
## [0.1.1]
|
7
10
|
- fix default location
|
8
11
|
- provide friendly error message when az not returning json
|
data/README.md
CHANGED
@@ -35,11 +35,28 @@ AzureInfo.tenant_id
|
|
35
35
|
|
36
36
|
This tool calls out to the az CLI. So the az CLI is required.
|
37
37
|
|
38
|
-
##
|
38
|
+
## Precedence
|
39
|
+
|
40
|
+
This library will return values using different sources with this precedence:
|
41
|
+
|
42
|
+
1. Environment variables: ARM_GROUP, ARM_LOCATION, ARM_SUBSCRIPTION_ID, ARM_TENANT_ID
|
43
|
+
2. az cli: Usually configured in the `~/.azure/config`. Use `az configure --list-defaults` to double check.
|
44
|
+
3. Defaults: A default is set for `location=eastus`. The other values must be configured.
|
45
|
+
|
46
|
+
The config file used by the `az` command looks something like this:
|
47
|
+
|
48
|
+
~/.azure/config
|
49
|
+
|
50
|
+
[cloud]
|
51
|
+
name = AzureCloud
|
52
|
+
|
53
|
+
[defaults]
|
54
|
+
location = eastus
|
55
|
+
|
56
|
+
## Setting the Defaults with az cli
|
39
57
|
|
40
58
|
az login --username EMAIL_ADDRESS -t TENANT_ID
|
41
59
|
az account set --subscription SUBSCRIPTION_ID
|
42
|
-
|
43
60
|
az configure --defaults location=eastus group=RESOURCE_GROUP
|
44
61
|
|
45
62
|
## Contributing
|
data/lib/azure_info.rb
CHANGED
@@ -8,21 +8,21 @@ module AzureInfo
|
|
8
8
|
class Error < StandardError; end
|
9
9
|
|
10
10
|
def group
|
11
|
-
configure.get("group")
|
11
|
+
ENV['ARM_GROUP'] || configure.get("group")
|
12
12
|
end
|
13
13
|
alias_method :group_id, :group
|
14
14
|
|
15
15
|
def location
|
16
|
-
configure.get("location") || "eastus"
|
16
|
+
ENV['ARM_LOCATION'] || configure.get("location") || "eastus"
|
17
17
|
end
|
18
18
|
|
19
19
|
def subscription_id
|
20
|
-
account.get("id")
|
20
|
+
ENV['ARM_SUBSCRIPTION_ID'] || account.get("id")
|
21
21
|
end
|
22
22
|
alias_method :subscription, :subscription_id
|
23
23
|
|
24
24
|
def tenant_id
|
25
|
-
account.get("tenantId")
|
25
|
+
ENV['ARM_TENANT_ID'] || account.get("tenantId")
|
26
26
|
end
|
27
27
|
alias_method :tenant, :tenant_id
|
28
28
|
|
data/lib/azure_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
rubygems_version: 3.
|
55
|
+
rubygems_version: 3.2.5
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: 'Azure info: Simple library to get current subscription, resource group,
|