diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-06-24 21:04:55 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-06-24 21:04:55 -0700 |
| commit | 70099adaab238d34c68947e00350df84e83d2270 (patch) | |
| tree | 2f0d620913912707962924cc52626901595d8e83 /nova | |
| parent | 6d8d59180088ec8855e088a217b58b741f34aac4 (diff) | |
Use flag for vpn key suffix instead of hardcoded string
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/cloudpipe/pipelib.py | 2 | ||||
| -rw-r--r-- | nova/endpoint/cloud.py | 7 | ||||
| -rw-r--r-- | nova/flags.py | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index cec3e5dca..5f6ccf82e 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -76,7 +76,7 @@ class CloudPipe(object): zippy.close() def setup_keypair(self, user_id, project_id): - key_name = '%s-key' % project_id + key_name = '%s%s' % (project_id, FLAGS.vpn_key_suffix) try: private_key, fingerprint = self.manager.generate_key_pair(user_id, key_name) try: diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index d6c164163..8eaa8213b 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -178,7 +178,8 @@ class CloudController(object): result = [] for key_pair in key_pairs: # filter out the vpn keys - if context.user.is_admin() or not key_pair.name.endswith('-key'): + suffix = FLAGS.vpn_key_suffix + if context.user.is_admin() or not key_pair.name.endswith(suffix): result.append({ 'keyName': key_pair.name, 'keyFingerprint': key_pair.fingerprint, @@ -609,9 +610,9 @@ class CloudController(object): result = { 'image_id': image_id, 'launchPermission': [] } if image['isPublic']: result['launchPermission'].append({ 'group': 'all' }) - + return defer.succeed(result) - + @rbac.allow('projectmanager', 'sysadmin') def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): # TODO(devcamcar): Support users and groups other than 'all'. diff --git a/nova/flags.py b/nova/flags.py index bf7b6e3a3..396276ea1 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -75,6 +75,10 @@ DEFINE_string('default_instance_type', DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', 'AMI for cloudpipe vpn server') +flags.DEFINE_string('vpn_key_suffix', + '-key', + 'Suffix to add to project name for vpn key') + # UNUSED DEFINE_string('node_availability_zone', 'nova', |
