Support profile resource_key when do profile-show

This commit is contained in:
tengqm
2015-02-03 22:17:52 +08:00
parent 81f144ad58
commit a0e2a72dab
2 changed files with 8 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ class ProfileTypeTemplate(resource.Resource):
class Profile(resource.Resource):
resource_key = 'profile'
resources_key = 'profiles'
base_path = '/profiles'
service = clustering_service.ClusteringService()

View File

@@ -144,9 +144,12 @@ def do_profile_show(sc, args):
['name', 'rollback', 'parameters', 'environment', 'template'],
['property', 'value']),
}
print(profile.to_dict())
utils.print_dict(profile.to_dict(), formatters=formatters)
@utils.arg('-f', '--force', default=False, action="store_true",
help=_('Delete the profile completely from database.'))
@utils.arg('id', metavar='<NAME or ID>', nargs='+',
help=_('Name or ID of profile(s) to delete.'))
def do_profile_delete(sc, args):
@@ -155,7 +158,10 @@ def do_profile_delete(sc, args):
for cid in args.id:
try:
query = {'id': cid}
query = {
'id': cid,
'force': args.force
}
sc.delete(models.Profile, query)
except exc.HTTPNotFound as ex:
failure_count += 1