Remove some useless code of flavor unset command

Change-Id: I547740ca439762383885044f6d41fb5df96802fc
This commit is contained in:
liusheng 2017-08-11 11:07:03 +08:00
parent cf3dbd365f
commit 19f7e038b6

View File

@ -257,20 +257,10 @@ class UnsetFlavor(command.Command):
bc_client.flavor, bc_client.flavor,
parsed_args.flavor, parsed_args.flavor,
) )
result = 0
if parsed_args.project: if parsed_args.project:
try: if data.is_public:
if data.is_public: msg = _("Cannot remove access for a public flavor")
msg = _("Cannot remove access for a public flavor") raise exceptions.CommandError(msg)
raise exceptions.CommandError(msg) else:
else: bc_client.flavor.remove_tenant_access(
bc_client.flavor.remove_tenant_access( data, parsed_args.project)
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"))