From 4e73888b2739b087fb1c2f02ee44000485d84e0a Mon Sep 17 00:00:00 2001 From: altanai Date: Fri, 1 Oct 2021 18:38:13 +0000 Subject: [PATCH] Refractor logs Optimize usage of logger so that manilla client does not import logger library when not needed. Closes-Bug: #1940692 Change-Id: Idcd327c1f4a2d0b56eb8487fcc885e5e744f0289 --- manilaclient/osc/v2/availability_zones.py | 3 --- manilaclient/osc/v2/messages.py | 4 ---- manilaclient/osc/v2/quotas.py | 10 ---------- manilaclient/osc/v2/share.py | 2 -- manilaclient/osc/v2/share_access_rules.py | 16 ---------------- .../osc/v2/share_instance_export_locations.py | 4 ---- manilaclient/osc/v2/share_instances.py | 2 -- manilaclient/osc/v2/share_limits.py | 4 ---- .../share_snapshot_instance_export_locations.py | 4 ---- manilaclient/osc/v2/share_snapshot_instances.py | 4 ---- manilaclient/osc/v2/share_type_access.py | 4 ---- manilaclient/osc/v2/share_types.py | 10 ---------- 12 files changed, 67 deletions(-) diff --git a/manilaclient/osc/v2/availability_zones.py b/manilaclient/osc/v2/availability_zones.py index 4df9a12e3..f8c8c00d0 100644 --- a/manilaclient/osc/v2/availability_zones.py +++ b/manilaclient/osc/v2/availability_zones.py @@ -10,15 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -import logging from osc_lib.command import command from osc_lib import utils as oscutils from manilaclient.common._i18n import _ -LOG = logging.getLogger(__name__) - class ShareAvailabilityZoneList(command.Lister): """List all availability zones.""" diff --git a/manilaclient/osc/v2/messages.py b/manilaclient/osc/v2/messages.py index ab067007c..632c51166 100644 --- a/manilaclient/osc/v2/messages.py +++ b/manilaclient/osc/v2/messages.py @@ -41,8 +41,6 @@ class DeleteMessage(command.Command): """Remove one or more messages.""" _description = _("Remove one or more messages") - log = logging.getLogger(__name__ + ".DeleteMessage") - def get_parser(self, prog_name): parser = super(DeleteMessage, self).get_parser(prog_name) parser.add_argument( @@ -77,8 +75,6 @@ class ListMessage(command.Lister): """Lists all messages.""" _description = _("Lists all messages") - log = logging.getLogger(__name__ + ".ListMessage") - def get_parser(self, prog_name): parser = super(ListMessage, self).get_parser(prog_name) parser.add_argument( diff --git a/manilaclient/osc/v2/quotas.py b/manilaclient/osc/v2/quotas.py index f46256b39..b4611a585 100644 --- a/manilaclient/osc/v2/quotas.py +++ b/manilaclient/osc/v2/quotas.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils @@ -19,8 +17,6 @@ from osc_lib import utils from manilaclient import api_versions from manilaclient.common._i18n import _ -LOG = logging.getLogger(__name__) - def _check_user_id_and_share_type_args(user_id, share_type): if user_id and share_type: @@ -33,8 +29,6 @@ class QuotaSet(command.Command): """Set quotas for a project or project/user or project/share-type.""" _description = _("Set Quota") - log = logging.getLogger(__name__ + ".QuotaSet") - def get_parser(self, prog_name): parser = super(QuotaSet, self).get_parser(prog_name) parser.add_argument( @@ -239,8 +233,6 @@ class QuotaShow(command.ShowOne): """List the quotas for a project or project/user or project/share-type.""" _description = _("Show Quota") - log = logging.getLogger(__name__ + ".QuotaShow") - def get_parser(self, prog_name): parser = super(QuotaShow, self).get_parser(prog_name) parser.add_argument( @@ -337,8 +329,6 @@ class QuotaDelete(command.Command): _description = _("Delete Quota") - log = logging.getLogger(__name__ + ".QuotaDelete") - def get_parser(self, prog_name): parser = super(QuotaDelete, self).get_parser(prog_name) parser.add_argument( diff --git a/manilaclient/osc/v2/share.py b/manilaclient/osc/v2/share.py index bd99615c1..04d54a545 100644 --- a/manilaclient/osc/v2/share.py +++ b/manilaclient/osc/v2/share.py @@ -96,8 +96,6 @@ class CreateShare(command.ShowOne): """Create a new share.""" _description = _("Create new share") - log = logging.getLogger(__name__ + ".CreateShare") - def get_parser(self, prog_name): parser = super(CreateShare, self).get_parser(prog_name) parser.add_argument( diff --git a/manilaclient/osc/v2/share_access_rules.py b/manilaclient/osc/v2/share_access_rules.py index c0b4158de..c666821e0 100644 --- a/manilaclient/osc/v2/share_access_rules.py +++ b/manilaclient/osc/v2/share_access_rules.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.cli import parseractions from osc_lib.command import command from osc_lib import exceptions @@ -22,8 +20,6 @@ from manilaclient.common._i18n import _ from manilaclient.common.apiclient import utils as apiutils from manilaclient.osc import utils -LOG = logging.getLogger(__name__) - ACCESS_RULE_ATTRIBUTES = [ 'id', 'share_id', @@ -42,8 +38,6 @@ class ShareAccessAllow(command.ShowOne): """Create a new share access rule.""" _description = _("Create new share access rule") - log = logging.getLogger(__name__ + ".CreateShareAccess") - def get_parser(self, prog_name): parser = super(ShareAccessAllow, self).get_parser(prog_name) parser.add_argument( @@ -122,8 +116,6 @@ class ShareAccessDeny(command.Command): """Delete a share access rule.""" _description = _("Delete a share access rule") - log = logging.getLogger(__name__ + ".DeleteShareAccess") - def get_parser(self, prog_name): parser = super(ShareAccessDeny, self).get_parser(prog_name) parser.add_argument( @@ -155,8 +147,6 @@ class ListShareAccess(command.Lister): """List share access rules.""" _description = _("List share access rule") - log = logging.getLogger(__name__ + ".ListShareAccess") - def get_parser(self, prog_name): parser = super(ListShareAccess, self).get_parser(prog_name) parser.add_argument( @@ -228,8 +218,6 @@ class ShowShareAccess(command.ShowOne): "Display a share access rule. " "Available for API microversion 2.45 and higher") - log = logging.getLogger(__name__ + ".ShowShareAccess") - def get_parser(self, prog_name): parser = super(ShowShareAccess, self).get_parser(prog_name) parser.add_argument( @@ -267,8 +255,6 @@ class SetShareAccess(command.Command): "Set properties to share access rule. " "Available for API microversion 2.45 and higher") - log = logging.getLogger(__name__ + ".SetShareAccess") - def get_parser(self, prog_name): parser = super(SetShareAccess, self).get_parser(prog_name) parser.add_argument( @@ -316,8 +302,6 @@ class UnsetShareAccess(command.Command): "Unset properties of share access rule. " "Available for API microversion 2.45 and higher") - log = logging.getLogger(__name__ + ".UnsetShareAccess") - def get_parser(self, prog_name): parser = super(UnsetShareAccess, self).get_parser(prog_name) parser.add_argument( diff --git a/manilaclient/osc/v2/share_instance_export_locations.py b/manilaclient/osc/v2/share_instance_export_locations.py index ac8b4506c..e8e75b702 100644 --- a/manilaclient/osc/v2/share_instance_export_locations.py +++ b/manilaclient/osc/v2/share_instance_export_locations.py @@ -13,15 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import utils as osc_utils from manilaclient.common._i18n import _ -LOG = logging.getLogger(__name__) - class ShareInstanceListExportLocation(command.Lister): """List share instance export locations.""" diff --git a/manilaclient/osc/v2/share_instances.py b/manilaclient/osc/v2/share_instances.py index c302d7eaa..2f48c667b 100644 --- a/manilaclient/osc/v2/share_instances.py +++ b/manilaclient/osc/v2/share_instances.py @@ -29,8 +29,6 @@ class ShareInstanceDelete(command.Command): """Forces the deletion of the share instance.""" _description = _("Forces the deletion of a share instance") - log = logging.getLogger(__name__ + ".ShareInstanceDelete") - def get_parser(self, prog_name): parser = super(ShareInstanceDelete, self).get_parser(prog_name) parser.add_argument( diff --git a/manilaclient/osc/v2/share_limits.py b/manilaclient/osc/v2/share_limits.py index e2afc69d4..1a3ff3056 100644 --- a/manilaclient/osc/v2/share_limits.py +++ b/manilaclient/osc/v2/share_limits.py @@ -12,15 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import utils as oscutils from manilaclient.common._i18n import _ -LOG = logging.getLogger(__name__) - class ShareLimitsShow(command.Lister): """Show a list of share limits for a user.""" diff --git a/manilaclient/osc/v2/share_snapshot_instance_export_locations.py b/manilaclient/osc/v2/share_snapshot_instance_export_locations.py index 64f4bdfc3..449987d8c 100644 --- a/manilaclient/osc/v2/share_snapshot_instance_export_locations.py +++ b/manilaclient/osc/v2/share_snapshot_instance_export_locations.py @@ -10,16 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import utils from manilaclient.common._i18n import _ from manilaclient.common.apiclient import utils as apiutils -LOG = logging.getLogger(__name__) - class ShareSnapshotInstanceExportLocationList(command.Lister): """List export locations from a share snapshot instance.""" diff --git a/manilaclient/osc/v2/share_snapshot_instances.py b/manilaclient/osc/v2/share_snapshot_instances.py index b6fc1c08d..2e44f9ddb 100644 --- a/manilaclient/osc/v2/share_snapshot_instances.py +++ b/manilaclient/osc/v2/share_snapshot_instances.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils @@ -19,8 +17,6 @@ from osc_lib import utils from manilaclient.common._i18n import _ from manilaclient.common import cliutils -LOG = logging.getLogger(__name__) - class ListShareSnapshotInstance(command.Lister): """List all share snapshot instances.""" diff --git a/manilaclient/osc/v2/share_type_access.py b/manilaclient/osc/v2/share_type_access.py index 2a2547adb..890f9bd51 100644 --- a/manilaclient/osc/v2/share_type_access.py +++ b/manilaclient/osc/v2/share_type_access.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import logging - from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as oscutils @@ -19,8 +17,6 @@ from osc_lib import utils as oscutils from manilaclient.common._i18n import _ from manilaclient.common.apiclient import utils as apiutils -LOG = logging.getLogger(__name__) - class ShareTypeAccessAllow(command.Command): """Add access for share type.""" diff --git a/manilaclient/osc/v2/share_types.py b/manilaclient/osc/v2/share_types.py index 6e04a0456..89ec406ff 100644 --- a/manilaclient/osc/v2/share_types.py +++ b/manilaclient/osc/v2/share_types.py @@ -65,8 +65,6 @@ class CreateShareType(command.ShowOne): _description = _( "Create new share type") - log = logging.getLogger(__name__ + ".CreateShareType") - def get_parser(self, prog_name): parser = super(CreateShareType, self).get_parser(prog_name) parser.add_argument( @@ -199,8 +197,6 @@ class DeleteShareType(command.Command): """Delete a share type.""" _description = _("Delete a share type") - log = logging.getLogger(__name__ + ".DeleteShareType") - def get_parser(self, prog_name): parser = super(DeleteShareType, self).get_parser(prog_name) parser.add_argument( @@ -240,8 +236,6 @@ class SetShareType(command.Command): """Set share type properties.""" _description = _("Set share type properties") - log = logging.getLogger(__name__ + ".SetShareType") - def get_parser(self, prog_name): parser = super(SetShareType, self).get_parser(prog_name) parser.add_argument( @@ -335,8 +329,6 @@ class UnsetShareType(command.Command): """Unset share type extra specs.""" _description = _("Unset share type extra specs") - log = logging.getLogger(__name__ + ".UnsetShareType") - def get_parser(self, prog_name): parser = super(UnsetShareType, self).get_parser(prog_name) parser.add_argument( @@ -370,8 +362,6 @@ class ListShareType(command.Lister): """List Share Types.""" _description = _("List share types") - log = logging.getLogger(__name__ + ".ListShareType") - def get_parser(self, prog_name): parser = super(ListShareType, self).get_parser(prog_name) parser.add_argument(