Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
configuration
Commits
eb492621
Commit
eb492621
authored
Aug 19, 2014
by
e0d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replacing colons in the state name
parent
c0854a19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
playbooks/edx-east/lifecycle_inventory.py
+9
-1
No files found.
playbooks/edx-east/lifecycle_inventory.py
View file @
eb492621
...
...
@@ -32,6 +32,7 @@ import argparse
import
boto
import
json
from
collections
import
defaultdict
import
re
class
LifecycleInventory
():
...
...
@@ -52,6 +53,13 @@ class LifecycleInventory():
return
dict
def
to_safe
(
self
,
word
):
''' Converts 'bad' characters in a string to underscores so they can be
used as Ansible groups '''
return
re
.
sub
(
"[:]"
,
"_"
,
word
)
def
run
(
self
):
autoscale
=
boto
.
connect_autoscale
(
profile_name
=
self
.
profile
)
groups
=
autoscale
.
get_all_groups
()
...
...
@@ -67,7 +75,7 @@ class LifecycleInventory():
inventory
[
group
.
name
]
.
append
(
private_ip_address
)
inventory
[
group
.
name
+
"_"
+
instance
.
lifecycle_state
]
.
append
(
private_ip_address
)
inventory
[
instance
.
lifecycle_state
]
.
append
(
private_ip_address
)
inventory
[
self
.
to_safe
(
instance
.
lifecycle_state
)
]
.
append
(
private_ip_address
)
print
json
.
dumps
(
inventory
,
sort_keys
=
True
,
indent
=
2
)
...
...
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