Disable jscpd
diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml
index 2453ccb..193eabe 100644
--- a/.github/workflows/linters.yaml
+++ b/.github/workflows/linters.yaml
@@ -12,3 +12,4 @@
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true
VALIDATE_PYTHON_MYPY: false
+ VALIDATE_JSCPD: false
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 3418ed8..ee0bcec 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -22,8 +22,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.autodoc",
- "openstackdocstheme",
-# 'sphinx.ext.intersphinx',
+ "openstackdocstheme"
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
diff --git a/staffeln/api/app.py b/staffeln/api/app.py
index 64ade58..14a180f 100755
--- a/staffeln/api/app.py
+++ b/staffeln/api/app.py
@@ -20,8 +20,7 @@
# Retrive the backup object from backup_data table with matching backup_id.
backup = objects.Volume.get_backup_by_backup_id(
- context=ctx,
- backup_id=request.args["backup_id"]
+ context=ctx, backup_id=request.args["backup_id"]
)
# backup_info is None when there is no entry of the backup id in backup_table.
# So the backup should not be the automated backup.
diff --git a/staffeln/api/wsgi.py b/staffeln/api/wsgi.py
index 45b9347..bef4092 100755
--- a/staffeln/api/wsgi.py
+++ b/staffeln/api/wsgi.py
@@ -1,3 +1,4 @@
import app
+
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)
diff --git a/staffeln/cmd/conductor.py b/staffeln/cmd/conductor.py
index 24ba590..f4c9579 100755
--- a/staffeln/cmd/conductor.py
+++ b/staffeln/cmd/conductor.py
@@ -1,11 +1,10 @@
"""Starter script for the staffeln conductor service."""
import cotyledon
+import staffeln.conf
from cotyledon import oslo_config_glue
-
from staffeln.common import service
from staffeln.conductor import manager
-import staffeln.conf
CONF = staffeln.conf.CONF
diff --git a/staffeln/cmd/dbmanage.py b/staffeln/cmd/dbmanage.py
index 467b52a..2331261 100644
--- a/staffeln/cmd/dbmanage.py
+++ b/staffeln/cmd/dbmanage.py
@@ -5,12 +5,10 @@
import sys
from oslo_config import cfg
-
-from staffeln.common import service
from staffeln import conf
+from staffeln.common import service
from staffeln.db import migration
-
CONF = conf.CONF
diff --git a/staffeln/common/short_id.py b/staffeln/common/short_id.py
index db4a3b1..18be04c 100755
--- a/staffeln/common/short_id.py
+++ b/staffeln/common/short_id.py
@@ -16,7 +16,7 @@
required.
"""
shifts = six.moves.xrange(num_bits - 8, -8, -8)
- byte_at = lambda off: ( # noqa: E731
+ byte_at = lambda off: ( # noqa: E731
(value >> off if off >= 0 else value << -off) & 0xFF
)
return "".join(chr(byte_at(offset)) for offset in shifts)
diff --git a/staffeln/common/time.py b/staffeln/common/time.py
index 27bcf4f..45e6ffe 100644
--- a/staffeln/common/time.py
+++ b/staffeln/common/time.py
@@ -31,7 +31,7 @@
if empty_flag:
return None
return time_params
- except: # noqa: E722
+ except: # noqa: E722
return None
diff --git a/staffeln/conductor/backup.py b/staffeln/conductor/backup.py
index f7fba5b..a6e5e92 100755
--- a/staffeln/conductor/backup.py
+++ b/staffeln/conductor/backup.py
@@ -8,6 +8,7 @@
from oslo_log import log
from staffeln import objects
from staffeln.common import constants, context, openstack
+from staffeln.conductor import result
from staffeln.i18n import _
CONF = staffeln.conf.CONF
diff --git a/staffeln/conductor/manager.py b/staffeln/conductor/manager.py
index 7994287..a6e93a9 100755
--- a/staffeln/conductor/manager.py
+++ b/staffeln/conductor/manager.py
@@ -1,4 +1,3 @@
-
import threading
import time
diff --git a/staffeln/conductor/result.py b/staffeln/conductor/result.py
index 63b8dd8..1414347 100644
--- a/staffeln/conductor/result.py
+++ b/staffeln/conductor/result.py
@@ -29,7 +29,7 @@
self.failed_backup_list[id] = []
def add_success_backup(self, project_id, volume_id, backup_id):
- if not project_id in self.success_backup_list:
+ if project_id not in self.success_backup_list:
LOG.error(_("Not registered project is reported for backup result."))
return
self.success_backup_list[project_id].append(
@@ -40,7 +40,7 @@
)
def add_failed_backup(self, project_id, volume_id, reason):
- if not project_id in self.failed_backup_list:
+ if project_id not in self.failed_backup_list:
LOG.error(_("Not registered project is reported for backup result."))
return
self.failed_backup_list[project_id].append(
diff --git a/staffeln/db/sqlalchemy/api.py b/staffeln/db/sqlalchemy/api.py
index 6956403..adfa7a7 100644
--- a/staffeln/db/sqlalchemy/api.py
+++ b/staffeln/db/sqlalchemy/api.py
@@ -143,7 +143,7 @@
def _add_filters(self, query, model, filters=None, plain_fields=None):
"""Add filters while listing the columns from database table"""
- timestamp_mixin_fields = ["created_at", "updated_at"]
+ # timestamp_mixin_fields = ["created_at", "updated_at"]
filters = filters or {}
for raw_fieldname, value in filters.items():
@@ -266,7 +266,7 @@
try:
return self._update(models.Backup_data, backup_id, values)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("backup resource not found.")
def create_queue(self, values):
@@ -288,7 +288,7 @@
try:
return self._update(models.Queue_data, id, values)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Queue resource not found.")
def get_queue_by_id(self, context, id):
@@ -303,13 +303,13 @@
return self._get(
context, model=models.Queue_data, fieldname=fieldname, value=value
)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Queue not found")
def soft_delete_queue(self, id):
try:
return self._soft_delete(models.Queue_data, id)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Queue Not found.")
def get_backup_by_backup_id(self, context, backup_id):
@@ -317,7 +317,7 @@
try:
return self._get_backup(context, fieldname="backup_id", value=backup_id)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Backup not found with backup_id %s." % backup_id)
def _get_backup(self, context, fieldname, value):
@@ -327,11 +327,11 @@
return self._get(
context, model=models.Backup_data, fieldname=fieldname, value=value
)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Backup resource not found.")
def soft_delete_backup(self, id):
try:
return self._soft_delete(models.Backup_data, id)
- except: # noqa: E722
+ except: # noqa: E722
LOG.error("Backup Not found.")
diff --git a/staffeln/objects/__init__.py b/staffeln/objects/__init__.py
index b9022af..4a5adfd 100755
--- a/staffeln/objects/__init__.py
+++ b/staffeln/objects/__init__.py
@@ -1,3 +1,6 @@
+from .queue import Queue
+from .volume import Volume
+
# from volume import Volume
def register_all():
__import__("staffeln.objects.volume")
diff --git a/staffeln/objects/volume.py b/staffeln/objects/volume.py
index 4b4f39f..741d5fe 100644
--- a/staffeln/objects/volume.py
+++ b/staffeln/objects/volume.py
@@ -21,14 +21,14 @@
}
@base.remotable_classmethod
- def list(cls, context, filters=None):
+ def list(self, context, filters=None):
"""Return a list of :class:`Backup` objects.
:param filters: dict mapping the filter to a value.
"""
- db_backups = cls.dbapi.get_backup_list(context, filters=filters)
+ db_backups = self.dbapi.get_backup_list(context, filters=filters)
- return [cls._from_db_object(cls(context), obj) for obj in db_backups]
+ return [self._from_db_object(self(context), obj) for obj in db_backups]
@base.remotable
def create(self):
@@ -66,7 +66,7 @@
self.dbapi.soft_delete_backup(self.id)
@base.remotable_classmethod
- def get_backup_by_backup_id(cls, context, backup_id):
+ def get_backup_by_backup_id(self, context, backup_id):
"""Find a backup based on backup_id
:param context: Security context. NOTE: This should only
be used internally by the indirection_api.
@@ -77,9 +77,9 @@
:param backup_id: the backup id of volume in volume data.
:returns: a :class:`Backup` object.
"""
- db_backup = cls.dbapi.get_backup_by_backup_id(context, backup_id)
+ db_backup = self.dbapi.get_backup_by_backup_id(context, backup_id)
if db_backup is None:
return db_backup
else:
- backup = cls._from_db_object(cls(context), db_backup)
+ backup = self._from_db_object(self(context), db_backup)
return backup