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
b7d644d4
Commit
b7d644d4
authored
May 14, 2015
by
Aleksey Zhukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken cache logic
parent
38615976
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
plugins/inventory/digital_ocean.py
+12
-2
No files found.
plugins/inventory/digital_ocean.py
View file @
b7d644d4
...
...
@@ -226,6 +226,9 @@ or environment variables (DO_API_TOKEN)'''
self
.
build_inventory
()
json_data
=
self
.
inventory
if
self
.
cache_refreshed
:
self
.
write_to_cache
()
if
self
.
args
.
pretty
:
print
json
.
dumps
(
json_data
,
sort_keys
=
True
,
indent
=
2
)
else
:
...
...
@@ -309,23 +312,30 @@ or environment variables (DO_API_TOKEN)'''
'''Get JSON from DigitalOcean API'''
if
self
.
args
.
force_cache
:
return
# We always get fresh droplets
if
self
.
is_cache_valid
()
and
not
(
resource
==
'droplets'
or
resource
is
None
):
return
if
self
.
args
.
refresh_cache
:
resource
=
None
if
resource
==
'droplets'
or
resource
is
None
:
self
.
data
[
'droplets'
]
=
self
.
manager
.
all_active_droplets
()
self
.
cache_refreshed
=
True
if
resource
==
'regions'
or
resource
is
None
:
self
.
data
[
'regions'
]
=
self
.
manager
.
all_regions
()
self
.
cache_refreshed
=
True
if
resource
==
'images'
or
resource
is
None
:
self
.
data
[
'images'
]
=
self
.
manager
.
all_images
(
filter
=
None
)
self
.
cache_refreshed
=
True
if
resource
==
'sizes'
or
resource
is
None
:
self
.
data
[
'sizes'
]
=
self
.
manager
.
sizes
()
self
.
cache_refreshed
=
True
if
resource
==
'ssh_keys'
or
resource
is
None
:
self
.
data
[
'ssh_keys'
]
=
self
.
manager
.
all_ssh_keys
()
self
.
cache_refreshed
=
True
if
resource
==
'domains'
or
resource
is
None
:
self
.
data
[
'domains'
]
=
self
.
manager
.
all_domains
()
self
.
write_to_cache
()
self
.
cache_refreshed
=
True
def
build_inventory
(
self
):
...
...
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