Refractor logs

Optimize usage of logger so that manilla client does not
import logger library when not needed.

Closes-Bug: #1940692
Change-Id: Idcd327c1f4a2d0b56eb8487fcc885e5e744f0289
This commit is contained in:
altanai 2021-10-01 18:38:13 +00:00
parent 32fad505c7
commit 4e73888b27
12 changed files with 0 additions and 67 deletions

View File

@ -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."""

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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."""

View File

@ -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(

View File

@ -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."""

View File

@ -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."""

View File

@ -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."""

View File

@ -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."""

View File

@ -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(