Add --is-public to image-create

This moves image-create closer to image-update by adding
--is-public and hiding the help output of --public. The
--public option will be removed once devstack no longer
depends on it.

Fix bug 1023632

Change-Id: I2c58655ba56eef1fa486246618c4fb5bd3c6c8cf
This commit is contained in:
Brian Waldon
2012-07-11 15:28:46 -07:00
parent c097432828
commit 49bc6f94f2

View File

@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import argparse
import copy import copy
import sys import sys
@@ -100,7 +101,11 @@ def do_image_show(gc, args):
help=('Similar to \'--location\' in usage, but this indicates that' help=('Similar to \'--location\' in usage, but this indicates that'
' the Glance server should immediately copy the data and' ' the Glance server should immediately copy the data and'
' store it in its configured image store.')) ' store it in its configured image store.'))
#NOTE(bcwaldon): This will be removed once devstack is updated
# to use --is-public
@utils.arg('--public', action='store_true', default=False, @utils.arg('--public', action='store_true', default=False,
help=argparse.SUPPRESS)
@utils.arg('--is-public', type=utils.string_to_bool,
help='Make image accessible to the public.') help='Make image accessible to the public.')
@utils.arg('--is-protected', type=utils.string_to_bool, @utils.arg('--is-protected', type=utils.string_to_bool,
help='Prevent image from being deleted.') help='Prevent image from being deleted.')
@@ -111,7 +116,7 @@ def do_image_create(gc, args):
# Filter out None values # Filter out None values
fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) fields = dict(filter(lambda x: x[1] is not None, vars(args).items()))
fields['is_public'] = fields.pop('public') fields['is_public'] = fields.get('is_public') or fields.pop('public')
if 'is_protected' in fields: if 'is_protected' in fields:
fields['protected'] = fields.pop('is_protected') fields['protected'] = fields.pop('is_protected')