Skip to content

Commit

Permalink
codacy fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Sachitanand Shelake <[email protected]>
  • Loading branch information
sachitanands committed Jan 31, 2022
1 parent 4cac866 commit 5ca4098
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 60 deletions.
4 changes: 1 addition & 3 deletions src/setup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@
# For any questions about this software or licensing,
# please email [email protected] or [email protected].

"""
init class for rgw
"""
"""init class for rgw."""
8 changes: 2 additions & 6 deletions src/setup/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
from cortx.utils.errors import BaseError

class SetupError(BaseError):
"""
Generic Exception with error code and output.
"""
"""Generic Exception with error code and output."""

def __init__(self, rc, message_id, *message_args):
"""
Initalize error message paramters.
"""
"""Initalize error message paramters."""
super().__init__(rc, message_id=message_id, *message_args)
22 changes: 13 additions & 9 deletions src/setup/rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@


class Rgw:
"""
Represents Utils and Performs setup related actions.
"""
"""Represents RGW and Performs setup related actions."""

@staticmethod
def validate(phase: str):
"""
Perform validtions
"""
"""Perform validtions."""

# Perform RPM validations
return 0

@staticmethod
def post_install(config_path: str):
"""
Performs post install operations
Performs post install operations.
"""

return 0

@staticmethod
def prepare(config_path: str):
"""
Performs prepare phase operations.
"""

return 0
Expand All @@ -48,15 +52,15 @@ def config(config_path: str):
@staticmethod
def init(config_path: str):
"""
Perform initialization
Perform initialization.
"""

return 0

@staticmethod
def test(config_path: str, plan: str):
"""
Perform configuration testing
Perform configuration testing.
"""

return 0
Expand Down
68 changes: 26 additions & 42 deletions src/setup/rgw_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,24 @@
from setup import Rgw
from error import SetupError

class SetupCmdBase(cmd):
"""
Setup cmd base class.
"""
class SetupCmdBase(Cmd):
"""Setup cmd base class."""

def __init__(self, *args):
"""
Initialize super class members
"""
"""Initialize super class members."""
super().__init__(*args)

def add_args(parser):
parser.add_argument('--services', default='services', help='services')
parser.add_argument('--config', default='config_url', help='config')

class PostInstallCmd(SetupCmdBase):
"""
PostInstall Setup Cmd
"""
"""PostInstall Setup Cmd."""

name = 'post_install'

def __init__(self, args: dict):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)

def process(self):
Expand All @@ -56,27 +50,25 @@ def process(self):


class PrepareCmd(SetupCmdBase):
"""
Prepare Setup Cmd
"""
"""Prepare Setup Cmd."""
name = 'prepare'

def __init__(self, args: dict):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)

def process(self):
return 0
Rgw.validate('prepare')
rc = Rgw.prepare(self._url)
return rc


class ConfigCmd(SetupCmdBase):
"""
Setup Config Cmd
"""
"""Setup Config Cmd."""
name = 'config'

def __init__(self, args):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)

def process(self):
Expand All @@ -86,13 +78,11 @@ def process(self):


class InitCmd(SetupCmdBase):
"""
Init Setup Cmd
"""
"""Init Setup Cmd."""
name = 'init'

def __init__(self, args):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)
self.config_path = args.config

Expand All @@ -103,13 +93,11 @@ def process(self):


class TestCmd(SetupCmdBase):
"""
Test Setup Cmd
"""
"""Test Setup Cmd."""
name = 'test'

def __init__(self, args):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)
self.config_path = args.config
# Default test_plan is 'sanity'
Expand All @@ -122,13 +110,11 @@ def process(self):


class ResetCmd(SetupCmdBase):
"""
Reset Setup Cmd
"""
"""Reset Setup Cmd."""
name = 'reset'

def __init__(self, args):
""" Initialize super class members """
""" Initialize super class members."""
super().__init__(args)
self.config_path = args.config

Expand All @@ -139,34 +125,32 @@ def process(self):


class CleanupCmd(SetupCmdBase):
"""
Cleanup Setup Cmd
"""
"""Cleanup Setup Cmd."""
name = 'cleanup'

def __init__(self, args: dict):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)
self.config_path = args.config

def process(self):
Rgw.validate('cleanup')
rc = Rgw.cleanup()
rc = Rgw.cleanup(self.config_path)
return rc


class UpgradeCmd(SetupCmdBase):
"""
Upgrade Setup Cmd
"""
"""Upgrade Setup Cmd."""
name = 'upgrade'

def __init__(self, args: dict):
"""Initialize super class members"""
"""Initialize super class members."""
super().__init__(args)
self.config_path = args.config

def process(self):
Rgw.validate('upgrade')
rc = Rgw.upgrade()
rc = Rgw.upgrade(self.config_path)
return rc


Expand Down

0 comments on commit 5ca4098

Please sign in to comment.