image: Rename import
This makes the code a little clearer. Change-Id: Ib552d510ca484571e59363ef15fe5e2cc0a2f4e1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
@@ -32,7 +32,7 @@ from osc_lib import utils
|
|||||||
|
|
||||||
from openstackclient.common import progressbar
|
from openstackclient.common import progressbar
|
||||||
from openstackclient.i18n import _
|
from openstackclient.i18n import _
|
||||||
from openstackclient.identity import common
|
from openstackclient.identity import common as identity_common
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
import msvcrt
|
import msvcrt
|
||||||
@@ -176,14 +176,14 @@ class AddProjectToImage(command.ShowOne):
|
|||||||
metavar="<project>",
|
metavar="<project>",
|
||||||
help=_("Project to associate with image (ID)"),
|
help=_("Project to associate with image (ID)"),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
image_client = self.app.client_manager.image
|
image_client = self.app.client_manager.image
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
project_id = common.find_project(
|
project_id = identity_common.find_project(
|
||||||
identity_client,
|
identity_client,
|
||||||
parsed_args.project,
|
parsed_args.project,
|
||||||
parsed_args.project_domain,
|
parsed_args.project_domain,
|
||||||
@@ -396,7 +396,7 @@ class CreateImage(command.ShowOne):
|
|||||||
"Force the use of glance image import instead of direct upload"
|
"Force the use of glance image import instead of direct upload"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
for deadopt in self.deadopts:
|
for deadopt in self.deadopts:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--%s" % deadopt,
|
"--%s" % deadopt,
|
||||||
@@ -449,7 +449,7 @@ class CreateImage(command.ShowOne):
|
|||||||
kwargs['visibility'] = parsed_args.visibility
|
kwargs['visibility'] = parsed_args.visibility
|
||||||
|
|
||||||
if parsed_args.project:
|
if parsed_args.project:
|
||||||
kwargs['owner_id'] = common.find_project(
|
kwargs['owner_id'] = identity_common.find_project(
|
||||||
identity_client,
|
identity_client,
|
||||||
parsed_args.project,
|
parsed_args.project,
|
||||||
parsed_args.project_domain,
|
parsed_args.project_domain,
|
||||||
@@ -764,7 +764,7 @@ class ListImage(command.Lister):
|
|||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
help=_("Search by project (admin only) (name or ID)"),
|
help=_("Search by project (admin only) (name or ID)"),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--tag',
|
'--tag',
|
||||||
metavar='<tag>',
|
metavar='<tag>',
|
||||||
@@ -845,7 +845,7 @@ class ListImage(command.Lister):
|
|||||||
kwargs['tag'] = parsed_args.tag
|
kwargs['tag'] = parsed_args.tag
|
||||||
project_id = None
|
project_id = None
|
||||||
if parsed_args.project:
|
if parsed_args.project:
|
||||||
project_id = common.find_project(
|
project_id = identity_common.find_project(
|
||||||
identity_client,
|
identity_client,
|
||||||
parsed_args.project,
|
parsed_args.project,
|
||||||
parsed_args.project_domain,
|
parsed_args.project_domain,
|
||||||
@@ -924,7 +924,7 @@ class ListImageProjects(command.Lister):
|
|||||||
metavar="<image>",
|
metavar="<image>",
|
||||||
help=_("Image (name or ID)"),
|
help=_("Image (name or ID)"),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@@ -962,15 +962,17 @@ class RemoveProjectImage(command.Command):
|
|||||||
metavar="<project>",
|
metavar="<project>",
|
||||||
help=_("Project to disassociate with image (name or ID)"),
|
help=_("Project to disassociate with image (name or ID)"),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
image_client = self.app.client_manager.image
|
image_client = self.app.client_manager.image
|
||||||
identity_client = self.app.client_manager.identity
|
identity_client = self.app.client_manager.identity
|
||||||
|
|
||||||
project_id = common.find_project(
|
project_id = identity_common.find_project(
|
||||||
identity_client, parsed_args.project, parsed_args.project_domain
|
identity_client,
|
||||||
|
parsed_args.project,
|
||||||
|
parsed_args.project_domain,
|
||||||
).id
|
).id
|
||||||
|
|
||||||
image = image_client.find_image(
|
image = image_client.find_image(
|
||||||
@@ -1175,7 +1177,7 @@ class SetImage(command.Command):
|
|||||||
metavar="<project>",
|
metavar="<project>",
|
||||||
help=_("Set an alternate project on this image (name or ID)"),
|
help=_("Set an alternate project on this image (name or ID)"),
|
||||||
)
|
)
|
||||||
common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
for deadopt in self.deadopts:
|
for deadopt in self.deadopts:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--%s" % deadopt,
|
"--%s" % deadopt,
|
||||||
@@ -1247,7 +1249,7 @@ class SetImage(command.Command):
|
|||||||
)
|
)
|
||||||
project_id = None
|
project_id = None
|
||||||
if parsed_args.project:
|
if parsed_args.project:
|
||||||
project_id = common.find_project(
|
project_id = identity_common.find_project(
|
||||||
identity_client,
|
identity_client,
|
||||||
parsed_args.project,
|
parsed_args.project,
|
||||||
parsed_args.project_domain,
|
parsed_args.project_domain,
|
||||||
|
Reference in New Issue
Block a user