azure_info 0.1.2 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/lib/azure_info/base.rb +18 -1
- data/lib/azure_info/configure.rb +4 -4
- data/lib/azure_info/version.rb +1 -1
- data/lib/azure_info.rb +2 -0
- 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: 646dd5f9bdd9dde86186dfbe79c9830f0350580f22ee314ddd25a5e35ad4542e
|
4
|
+
data.tar.gz: 4d40f19ff4c6d1651871d43436c7e8901ce917fa75c1cf506a3c4ba132ecf530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a9dc4214da271076da2f09dea0388d9a27ec32e3fb120e4d0b8197d46c17aaf941514cb46a01d9567a1f7e2c6f0357fc1bac60d5d08adeae86b156fd0f471f1
|
7
|
+
data.tar.gz: 8aeee66d296a7c30fad2ecce720c85c6fc41d83d8d23e9ad21e49ed0e6b50e8858348340e2057bcbc42e9760c5230aa27aec9ada09cedb523a3d9daa509c68b9
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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.3] - 2021-12-27
|
7
|
+
- [#3](https://github.com/boltops-tools/azure_info/pull/3) improve error message when az cli not installed
|
8
|
+
- comment about what is used in the account and configure object
|
9
|
+
|
6
10
|
## [0.1.2] - 2021-04-15
|
7
11
|
- [#2](https://github.com/boltops-tools/azure_info/pull/2) consider env vars also
|
8
12
|
|
data/README.md
CHANGED
data/lib/azure_info/base.rb
CHANGED
@@ -3,7 +3,24 @@ module AzureInfo
|
|
3
3
|
def check_az_installed!
|
4
4
|
installed = system("type az > /dev/null 2>&1")
|
5
5
|
return if installed
|
6
|
-
|
6
|
+
message = <<~EOL
|
7
|
+
ERROR: az is not installed. Please install the az command and configure it.
|
8
|
+
AzureInfo uses it to detect azure resource group, location, subscription id, and tenant id.
|
9
|
+
|
10
|
+
You can also configure these environment variables instead of installing the az cli.
|
11
|
+
|
12
|
+
ARM_CLIENT_ID
|
13
|
+
ARM_CLIENT_SECRET
|
14
|
+
ARM_SUBSCRIPTION_ID
|
15
|
+
ARM_TENANT_ID
|
16
|
+
|
17
|
+
EOL
|
18
|
+
if ENV['AZ_INFO_RAISE_ERROR']
|
19
|
+
raise Error.new(message)
|
20
|
+
else
|
21
|
+
puts message
|
22
|
+
exit 1
|
23
|
+
end
|
7
24
|
end
|
8
25
|
end
|
9
26
|
end
|
data/lib/azure_info/configure.rb
CHANGED
@@ -5,18 +5,18 @@
|
|
5
5
|
module AzureInfo
|
6
6
|
class Configure < Base
|
7
7
|
def get(name)
|
8
|
-
item =
|
8
|
+
item = az_configure_list_defaults.find do |i|
|
9
9
|
i["name"] == name
|
10
10
|
end
|
11
11
|
item["value"] if item
|
12
12
|
end
|
13
13
|
|
14
14
|
# looks like az configure stores settings in ~/.azure/config
|
15
|
-
def
|
16
|
-
return @
|
15
|
+
def az_configure_list_defaults
|
16
|
+
return @az_configure_list_defaults if @az_configure_list_defaults
|
17
17
|
check_az_installed!
|
18
18
|
out = `az configure --list-defaults --output json`.strip
|
19
|
-
@
|
19
|
+
@az_configure_list_defaults = JSON.load(out)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/azure_info/version.rb
CHANGED
data/lib/azure_info.rb
CHANGED
@@ -27,10 +27,12 @@ module AzureInfo
|
|
27
27
|
alias_method :tenant, :tenant_id
|
28
28
|
|
29
29
|
private
|
30
|
+
# info: group (resource group), location
|
30
31
|
def configure
|
31
32
|
@configure ||= Configure.new
|
32
33
|
end
|
33
34
|
|
35
|
+
# info: id (subscription id), name (subscription name), tenantId
|
34
36
|
def account
|
35
37
|
@account ||= Account.new
|
36
38
|
end
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-27 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.2.
|
55
|
+
rubygems_version: 3.2.32
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: 'Azure info: Simple library to get current subscription, resource group,
|