Removed openstackapi usages from api.
diff --git a/staffeln/api/app.py b/staffeln/api/app.py
index e75a5c7..62865f7 100755
--- a/staffeln/api/app.py
+++ b/staffeln/api/app.py
@@ -25,35 +25,17 @@
backup_id = request.args["backup_id"]
# Retrive the backup object from backup_data table with matching backup_id.
- backup_info = objects.Volume.get_backup_by_backup_id(ctx, backup_id)
+ backup = objects.Volume.get_backup_by_backup_id(ctx, backup_id)
# backup_info is None when there is no entry of the backup id in backup_table.
- if backup_info is None:
- LOG.info("No record of backup in storage. Checking cloud for backup")
- try:
- backup = conn.block_storage.get_backup(backup_id)
- except exc.ResourceNotFound:
- return Response(
- "Backup Resource not found for the provided backup id.",
- status=404,
- mimetype="text/plain",
- )
- except:
- return Response("Internal Server Error.", status=500, mimetype="text/plain")
- metadata = backup.metadata
- if metadata is not None:
- if metadata["__automated_backup"] is True:
- return Response("Deny", status=401, mimetype="text/plain")
-
+ # So the backup should not be the automated backup.
+ if backup is None:
return Response(
"True",
status=200,
mimetype="text/plain",
)
- metadata = backup_info.backup_metadata
- if metadata["__automated_backup"] is True:
- return Response("Deny", status=401, mimetype="text/plain")
else:
- return Response("True", status=200, mimetype="text/plain")
+ return Response("Deny", status=401, mimetype="text/plain")
def run(host, port, ssl_context):
diff --git a/staffeln/db/sqlalchemy/models.py b/staffeln/db/sqlalchemy/models.py
index 7ec8a4e..715d747 100644
--- a/staffeln/db/sqlalchemy/models.py
+++ b/staffeln/db/sqlalchemy/models.py
@@ -4,12 +4,18 @@
from oslo_db.sqlalchemy import models
from oslo_serialization import jsonutils
+from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy import Float
+from sqlalchemy import ForeignKey
from sqlalchemy import Integer
+from sqlalchemy import LargeBinary
+from sqlalchemy import orm
+from sqlalchemy import Numeric
from sqlalchemy import String
-from sqlalchemy import JSON
+from sqlalchemy import Text
from sqlalchemy.types import TypeDecorator, TEXT
from sqlalchemy import UniqueConstraint
import urllib.parse as urlparse
@@ -59,7 +65,6 @@
volume_id = Column(String(100))
instance_id = Column(String(100))
backup_completed = Column(Integer())
- backup_metadata = Column(JSON(), nullable=True)
class Queue_data(Base):
diff --git a/staffeln/objects/volume.py b/staffeln/objects/volume.py
index 62ed2b4..abe03ad 100644
--- a/staffeln/objects/volume.py
+++ b/staffeln/objects/volume.py
@@ -17,7 +17,6 @@
"instance_id": sfeild.StringField(),
"volume_id": sfeild.UUIDField(),
"backup_completed": sfeild.IntegerField(),
- "backup_metadata": sfeild.JsonField(),
}
@base.remotable_classmethod