Merge "Remove some useless code of flavor unset command"

This commit is contained in:
Jenkins 2017-08-17 10:38:50 +00:00 committed by Gerrit Code Review
commit bbcfb8d8fc

View File

@ -257,20 +257,10 @@ class UnsetFlavor(command.Command):
bc_client.flavor,
parsed_args.flavor,
)
result = 0
if parsed_args.project:
try:
if data.is_public:
msg = _("Cannot remove access for a public flavor")
raise exceptions.CommandError(msg)
else:
bc_client.flavor.remove_tenant_access(
data, parsed_args.project)
except Exception as e:
LOG.error("Failed to remove flavor access to project: %s", e)
result += 1
if result > 0:
raise exceptions.CommandError(_("Command Failed: One or more of"
" the operations failed"))
if data.is_public:
msg = _("Cannot remove access for a public flavor")
raise exceptions.CommandError(msg)
else:
bc_client.flavor.remove_tenant_access(
data, parsed_args.project)