Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ac67351d
Commit
ac67351d
authored
Jul 30, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8366 from jlaska/azure_fixes
Several azure fixes
parents
19bf388a
7288a609
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
library/cloud/azure
+14
-8
No files found.
library/cloud/azure
View file @
ac67351d
...
...
@@ -179,8 +179,7 @@ try:
PublicKey
,
LinuxConfigurationSet
,
ConfigurationSetInputEndpoints
,
ConfigurationSetInputEndpoint
)
except
ImportError
:
print
"failed=True msg='azure required for this module'"
print
"failed=True msg='azure required for this module'"
sys
.
exit
(
1
)
from
distutils.version
import
LooseVersion
...
...
@@ -338,6 +337,7 @@ def terminate_virtual_machine(module, azure):
changed
=
False
deployment
=
None
public_dns_name
=
None
disk_names
=
[]
try
:
deployment
=
azure
.
get_deployment_by_name
(
service_name
=
name
,
deployment_name
=
name
)
...
...
@@ -368,18 +368,24 @@ def terminate_virtual_machine(module, azure):
_wait_for_completion
(
azure
,
result
,
wait_timeout
,
"delete_hosted_service"
)
except
WindowsAzureError
as
e
:
module
.
fail_json
(
msg
=
"failed to delete the service
%
s, error was:
%
s"
%
(
name
,
str
(
e
)))
public_dns_name
=
urlparse
(
deployment
.
url
)
.
hostname
return
changed
,
urlparse
(
deployment
.
url
)
.
host
name
,
deployment
return
changed
,
public_dns_
name
,
deployment
def
get_azure_creds
(
module
):
# Check modul args for credentials, then check environment vars
subscription_id
=
module
.
params
.
get
(
'subscription_id'
)
management_cert_path
=
module
.
params
.
get
(
'management_cert_path'
)
if
not
subscription_id
:
subscription_id
=
os
.
environ
[
'AZURE_SUBSCRIPTION_ID'
]
management_cert_path
=
os
.
environ
[
'AZURE_CERT_PATH'
]
subscription_id
=
os
.
environ
.
get
(
'AZURE_SUBSCRIPTION_ID'
,
None
)
if
not
subscription_id
:
module
.
fail_json
(
msg
=
"No subscription_id provided. Please set 'AZURE_SUBSCRIPTION_ID' or use the 'subscription_id' parameter"
)
management_cert_path
=
module
.
params
.
get
(
'management_cert_path'
)
if
not
management_cert_path
:
management_cert_path
=
os
.
environ
.
get
(
'AZURE_CERT_PATH'
,
None
)
if
not
management_cert_path
:
module
.
fail_json
(
msg
=
"No management_cert_path provided. Please set 'AZURE_CERT_PATH' or use the 'management_cert_path' parameter"
)
return
subscription_id
,
management_cert_path
...
...
@@ -414,7 +420,7 @@ def main():
# wrapper for handling redirects which the sdk <= 0.8.0 is not following
azure
=
Wrapper
(
ServiceManagementService
(
subscription_id
,
management_cert_path
),
wait_timeout_redirects
)
else
:
azure
=
ServiceManagementService
(
subscription_id
,
management_cert_path
)
,
wait_timeout_redirects
azure
=
ServiceManagementService
(
subscription_id
,
management_cert_path
)
cloud_service_raw
=
None
if
module
.
params
.
get
(
'state'
)
==
'absent'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment