Skip to content

Commit

Permalink
openstack: make _default_if_none static
Browse files Browse the repository at this point in the history
  • Loading branch information
gwarf committed Aug 30, 2018
1 parent 53830d3 commit d07d879
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions cloud_info/providers/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,6 @@ def _get_dn(self, x509name):

return obj_name[start:end]

def _default_if_none(self, key_value, endpoint_type, defaults, key_suffix):
"""Get default value if None
Build key from endpoint_type and return value from default
"""
if key_value is not None:
field_value = key_value
else:
field_name = 'compute_%s_%s' % (endpoint_type, key_suffix)
field_value = defaults.get(field_name, 'UNKNOWN')
return field_value

@_rescope
def get_compute_endpoints(self, os_project_name=None, **kwargs):
# Hard-coded defaults for supported endpoints types
Expand Down Expand Up @@ -459,6 +447,19 @@ def get_compute_quotas(self, os_project_name=None, **kwargs):

return quotas

@staticmethod
def _default_if_none(key_value, endpoint_type, defaults, key_suffix):
"""Get default value if None
Build key from endpoint_type and return value from default
"""
if key_value is not None:
field_value = key_value
else:
field_name = 'compute_%s_%s' % (endpoint_type, key_suffix)
field_value = defaults.get(field_name, 'UNKNOWN')
return field_value

@staticmethod
def occify(term_name):
'''Occifies a term_name so that it is compliant with GFD 185.'''
Expand Down

0 comments on commit d07d879

Please sign in to comment.