Commit 9336a38f authored by Christos Stavrakakis's avatar Christos Stavrakakis

Use --deleted=True|False in flavor-modify

parent 5a265c71
......@@ -37,21 +37,22 @@ from django.core.management.base import BaseCommand, CommandError
from synnefo.management.common import get_flavor
from logging import getLogger
log = getLogger(__name__)
class Command(BaseCommand):
args = "<flavor id>"
help = "Modify a flavor"
option_list = BaseCommand.option_list + (
make_option(
'--set-deleted',
action='store_true',
dest='deleted',
help="Mark a server as deleted"),
make_option(
'--set-undeleted',
action='store_true',
dest='undeleted',
help="Mark a server as not deleted"),
"--deleted",
dest="deleted",
metavar="True|False",
choices=["True", "False"],
default=None,
help="Mark/unmark a flavor as deleted"),
)
def handle(self, *args, **options):
......@@ -60,9 +61,10 @@ class Command(BaseCommand):
flavor = get_flavor(args[0])
if options.get('deleted'):
flavor.deleted = True
elif options.get('undeleted'):
flavor.deleted = False
flavor.save()
deleted = options['deleted']
if deleted:
log.info("Marking flavor %s as deleted=%s", flavor, deleted)
flavor.deleted = deleted
flavor.save()
else:
log.info("Nothing changed!")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment