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
ad10b033
Commit
ad10b033
authored
Jun 14, 2013
by
Joe Blaylock
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #107 from edx/jrbl/fixing_ec2_ini
Extend ec2.py to accept an ini file
parents
329334c5
2d3539b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
playbooks/ec2.py
+7
-2
playbooks/edx-west/ec2.ini
+6
-0
No files found.
playbooks/ec2.py
View file @
ad10b033
#!/usr/bin/env python
import
sys
import
os
'''
EC2 external inventory script
=================================
...
...
@@ -135,8 +138,8 @@ class Ec2Inventory(object):
self
.
index
=
{}
# Read settings and parse CLI arguments
self
.
read_settings
()
self
.
parse_cli_args
()
self
.
read_settings
()
# Cache
if
self
.
args
.
refresh_cache
:
...
...
@@ -175,7 +178,7 @@ class Ec2Inventory(object):
''' Reads the settings from the ec2.ini file '''
config
=
ConfigParser
.
SafeConfigParser
()
config
.
read
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
'/ec2.ini'
)
config
.
read
(
self
.
args
.
inifile
)
# is eucalyptus?
self
.
eucalyptus_host
=
None
...
...
@@ -219,6 +222,7 @@ class Ec2Inventory(object):
help
=
'Get all the variables about a specific instance'
)
parser
.
add_argument
(
'--refresh-cache'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Force refresh of cache by making API requests to EC2 (default: False - use cache files)'
)
parser
.
add_argument
(
'--inifile'
,
dest
=
'inifile'
,
help
=
'Path to init script to use'
,
default
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
'/ec2.ini'
,)
self
.
args
=
parser
.
parse_args
()
...
...
@@ -431,3 +435,4 @@ class Ec2Inventory(object):
# Run the script
Ec2Inventory
()
playbooks/edx-west/ec2.ini
0 → 100644
View file @
ad10b033
[ec2]
regions
=
us-west-1
destination_variable
=
public_dns_name
vpc_destination_variable
=
private_dns_name
cache_path
=
/tmp
cache_max_age
=
300
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