Skip to content

Commit

Permalink
Merge pull request #131 from arthurlogilab/network-id-0.9
Browse files Browse the repository at this point in the history
[network-id] add an optional config to specify network-id
  • Loading branch information
bcwaldon committed Nov 1, 2014
2 parents 18d7171 + 99a2eda commit 328723a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cloudenvy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'auto_provision': False,
'forward_agent': True,
'default_cloud': None,
'network_id': None,
'dotfiles': '.vimrc, .gitconfig, .gitignore, .screenrc',
'sec_groups': [
'icmp, -1, -1, 0.0.0.0/0',
Expand Down Expand Up @@ -50,6 +51,7 @@ def __init__(self, config):
self.forward_agent = self._get_config('forward_agent')

self.cloud_type = 'openstack' if 'os_auth_url' in self.user_config['cloud'] else 'ec2'
self.network_id = self._get_config('network_id')

def _get_config(self, name, default=None):
"""Traverse the various config files in order of specificity.
Expand Down
3 changes: 3 additions & 0 deletions cloudenvy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def build_server(self):
# userdata_path = self.project_config['userdata_path']
# logging.info('Using userdata from: %s', userdata_path)
# build_kwargs['user_data'] = userdata_path
if self.config.network_id:
logging.info('Adding network-id configuration.')
build_kwargs['nics'] = [{'net-id': self.config.network_id,},]

logging.info('Creating server...')
server = self.cloud_api.create_server(**build_kwargs)
Expand Down
1 change: 1 addition & 0 deletions etc/Envyfile.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ project_config:
#remote_user: ubuntu
#flavor_name: m1.small
#auto_provision: False
#network_id : 00000000-0000-0000-0000-000000000000
provision_scripts:
#- provision_script.sh
1 change: 1 addition & 0 deletions etc/cloudenvy.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cloudenvy:
os_password: password
os_tenant_name: tenant_name
os_auth_url: http://keystone.example.com:5000/v2.0/
#network_id : 00000000-0000-0000-0000-000000000000

# Optional
#os_region_name: RegionOne
Expand Down

0 comments on commit 328723a

Please sign in to comment.