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
96fdb174
Commit
96fdb174
authored
Aug 28, 2013
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dns tool to take the stack name.
parent
e9fb73c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
util/vpc-tools/vpc-dns.py
+9
-3
util/vpc-tools/vpc-tools.py
+2
-8
util/vpc-tools/vpcutil.py
+9
-0
No files found.
util/vpc-tools/vpc-dns.py
View file @
96fdb174
"""vpc-dns.py
Usage:
vpc-dns.py create-zone
vpc <vpc-id>
vpc-dns.py create-zone
(vpc <vpc_id> | stack-name <stack_name>)
vpc-dns.py (-h --help)
vpc-dns.py (-v --version)
...
...
@@ -12,6 +12,7 @@ Options:
import
boto
from
boto.route53.record
import
ResourceRecordSets
from
docopt
import
docopt
from
vpcutil
import
vpc_for_stack_name
class
VPCDns
:
BACKEND_ZONE
=
"Z4AI6ADZTL3HN"
...
...
@@ -106,8 +107,13 @@ class VPCDns:
VERSION
=
"0.1"
def
dispatch
(
args
):
vpc_id
=
args
.
get
(
"<vpc-id>"
)
if
args
.
get
(
"vpc"
):
vpc_id
=
args
.
get
(
"<vpc_id>"
)
elif
args
.
get
(
"stack-name"
):
stack_name
=
args
.
get
(
"<stack_name>"
)
vpc_id
=
vpc_for_stack_name
(
stack_name
)
else
:
raise
Exception
(
"No vpc_id or stack_name provided."
)
c
=
VPCDns
(
vpc_id
=
vpc_id
)
...
...
util/vpc-tools/vpc-tools.py
View file @
96fdb174
...
...
@@ -12,6 +12,7 @@ Options:
"""
import
boto
from
docopt
import
docopt
from
vpcutil
import
vpc_for_stack_name
VERSION
=
"vpc tools 0.1"
...
...
@@ -43,13 +44,6 @@ def dispatch(args):
if
args
.
get
(
"ssh-config"
):
_ssh_config
(
args
)
def
vpc_for_stack_name
(
stack_name
):
cfn
=
boto
.
connect_cloudformation
()
resources
=
cfn
.
list_stack_resources
(
stack_name
)
for
resource
in
resources
:
if
resource
.
resource_type
==
'AWS::EC2::VPC'
:
return
resource
.
physical_resource_id
def
_ssh_config
(
args
):
if
args
.
get
(
"vpc"
):
vpc_id
=
args
.
get
(
"<vpc_id>"
)
...
...
@@ -57,7 +51,7 @@ def _ssh_config(args):
stack_name
=
args
.
get
(
"<stack_name>"
)
vpc_id
=
vpc_for_stack_name
(
stack_name
)
else
:
raise
Exception
(
"No
way to know which vpc to query
."
)
raise
Exception
(
"No
vpc_idao or stack_name provided
."
)
vpc
=
boto
.
connect_vpc
()
...
...
util/vpc-tools/vpcutil.py
0 → 100644
View file @
96fdb174
import
boto
def
vpc_for_stack_name
(
stack_name
):
cfn
=
boto
.
connect_cloudformation
()
resources
=
cfn
.
list_stack_resources
(
stack_name
)
for
resource
in
resources
:
if
resource
.
resource_type
==
'AWS::EC2::VPC'
:
return
resource
.
physical_resource_id
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