mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Updated so that the credentials file is only interogated if it exists (#42)
* Updated so that the credentials file is only interogated if it exists Fixes #39 Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk> * Made change to set credentials to nil as requested Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
This commit is contained in:
parent
fc43e87ee2
commit
a2289bfcbe
1 changed files with 4 additions and 1 deletions
|
@ -29,6 +29,7 @@ class AzureConnection
|
|||
if File.file?(azure_creds_file)
|
||||
@credentials = IniFile.load(File.expand_path(azure_creds_file))
|
||||
else
|
||||
@credentials = nil
|
||||
warn format('%s was not found or not accessible', azure_creds_file)
|
||||
end
|
||||
end
|
||||
|
@ -56,7 +57,9 @@ class AzureConnection
|
|||
@subscription_id = azure_subscription_id
|
||||
|
||||
# Check that the credential exists
|
||||
raise format('The specified Azure Subscription cannot be found in your credentials: %s', subscription_id) unless @credentials.sections.include?(subscription_id)
|
||||
unless @credentials.nil?
|
||||
raise format('The specified Azure Subscription cannot be found in your credentials: %s', subscription_id) unless @credentials.sections.include?(subscription_id)
|
||||
end
|
||||
|
||||
# Determine the client_id, tenant_id and the client_secret
|
||||
tenant_id = ENV['AZURE_TENANT_ID'] || @credentials[subscription_id]['tenant_id']
|
||||
|
|
Loading…
Reference in a new issue