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
b174b1a5
Commit
b174b1a5
authored
Jun 12, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'matlockx-devel' into devel
parents
8a1741e2
1173a8d6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
library/cloud/azure
+0
-0
plugins/inventory/windows_azure.py
+12
-2
No files found.
library/cloud/azure
View file @
b174b1a5
This diff is collapsed.
Click to expand it.
plugins/inventory/windows_azure.py
View file @
b174b1a5
...
...
@@ -80,8 +80,9 @@ class AzureInventory(object):
elif
not
self
.
is_cache_valid
():
self
.
do_api_calls_update_cache
()
# Data to print
if
self
.
args
.
list
:
if
self
.
args
.
list_images
:
data_to_print
=
self
.
json_format_dict
(
self
.
get_images
(),
True
)
elif
self
.
args
.
list
:
# Display list of nodes for inventory
if
len
(
self
.
inventory
)
==
0
:
data_to_print
=
self
.
get_inventory_from_cache
()
...
...
@@ -90,6 +91,13 @@ class AzureInventory(object):
print
data_to_print
def
get_images
(
self
):
images
=
[]
for
image
in
self
.
sms
.
list_os_images
():
if
str
(
image
.
label
)
.
lower
()
.
find
(
self
.
args
.
list_images
.
lower
())
>=
0
:
images
.
append
(
vars
(
image
))
return
json
.
loads
(
json
.
dumps
(
images
,
default
=
lambda
o
:
o
.
__dict__
))
def
is_cache_valid
(
self
):
"""Determines if the cache file has expired, or if it is still valid."""
if
os
.
path
.
isfile
(
self
.
cache_path_cache
):
...
...
@@ -131,6 +139,8 @@ class AzureInventory(object):
parser
=
argparse
.
ArgumentParser
(
description
=
'Produce an Ansible Inventory file based on Azure'
)
parser
.
add_argument
(
'--list'
,
action
=
'store_true'
,
default
=
True
,
help
=
'List nodes (default: True)'
)
parser
.
add_argument
(
'--list-images'
,
action
=
'store'
,
help
=
'Get all available images.'
)
parser
.
add_argument
(
'--refresh-cache'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Force refresh of cache by making API requests to Azure (default: False - use cache files)'
)
self
.
args
=
parser
.
parse_args
()
...
...
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