Use flag for vpn key suffix instead of hardcoded string

This commit is contained in:
Vishvananda Ishaya
2010-06-24 21:04:55 -07:00
parent c08fe5604c
commit 67829efba3
2 changed files with 8 additions and 3 deletions

View File

@@ -178,7 +178,8 @@ class CloudController(object):
result = [] result = []
for key_pair in key_pairs: for key_pair in key_pairs:
# filter out the vpn keys # 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({ result.append({
'keyName': key_pair.name, 'keyName': key_pair.name,
'keyFingerprint': key_pair.fingerprint, 'keyFingerprint': key_pair.fingerprint,
@@ -609,9 +610,9 @@ class CloudController(object):
result = { 'image_id': image_id, 'launchPermission': [] } result = { 'image_id': image_id, 'launchPermission': [] }
if image['isPublic']: if image['isPublic']:
result['launchPermission'].append({ 'group': 'all' }) result['launchPermission'].append({ 'group': 'all' })
return defer.succeed(result) return defer.succeed(result)
@rbac.allow('projectmanager', 'sysadmin') @rbac.allow('projectmanager', 'sysadmin')
def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs): def modify_image_attribute(self, context, image_id, attribute, operation_type, **kwargs):
# TODO(devcamcar): Support users and groups other than 'all'. # TODO(devcamcar): Support users and groups other than 'all'.

View File

@@ -75,6 +75,10 @@ DEFINE_string('default_instance_type',
DEFINE_string('vpn_image_id', 'ami-CLOUDPIPE', 'AMI for cloudpipe vpn server') 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 # UNUSED
DEFINE_string('node_availability_zone', DEFINE_string('node_availability_zone',
'nova', 'nova',