def remove_extra_spec(self, extra_spec_key_name):
deleted_flag = False
assert isinstance(extra_spec_key_name, basestring)
try:
LOG.debug("remove extra_spec {} from flavor {}".format(extra_spec_key_name,
str(self)))
for extra_spec in reversed(self.flavor_extra_specs):
if extra_spec.key_name == extra_spec_key_name:
self.flavor_extra_specs.remove(extra_spec)
deleted_flag = True
if not deleted_flag:
# no need to raise in delete not found
LOG.debug(
"Failed to remove extra_spec {0} from flavor id {1}".format(
extra_spec_key_name, str(self.id)))
except ErrorStatus as e:
raise
except Exception as exception:
LOG.log_exception(
"Failed to remove extra_spec {0} from flavor {1}".format(extra_spec_key_name, str(self)), exception)
raise
评论列表
文章目录