-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
Signed-off-by: Andre Kurait <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
import logging | ||
from typing import Tuple | ||
from console_link.models.snapshot import Snapshot, SnapshotStatus | ||
from console_link.models.snapshot import Snapshot | ||
from console_link.models.command_result import CommandResult | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def create(snapshot: Snapshot, *args, **kwargs) -> Tuple[SnapshotStatus, str]: | ||
def create(snapshot: Snapshot, *args, **kwargs) -> CommandResult: | ||
logger.info(f"Creating snapshot with {args=} and {kwargs=}") | ||
try: | ||
result = snapshot.create(*args, **kwargs) | ||
return snapshot.create(*args, **kwargs) | ||
Check warning on line 11 in TrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py Codecov / codecov/patchTrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py#L11
|
||
except Exception as e: | ||
logger.error(f"Failure running create snapshot: {e}") | ||
return SnapshotStatus.FAILED, f"Failure running create snapshot: {e}" | ||
return CommandResult(status=False, message=f"Failure running create snapshot: {e}") | ||
Check warning on line 14 in TrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py Codecov / codecov/patchTrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py#L13-L14
|
||
|
||
if not result.success: | ||
return SnapshotStatus.FAILED, "Snapshot creation failed." + "\n" + result.value | ||
|
||
return status(snapshot, *args, **kwargs) | ||
|
||
|
||
def status(snapshot: Snapshot, *args, **kwargs) -> str: | ||
def status(snapshot: Snapshot, *args, **kwargs) -> CommandResult: | ||
logger.info("Getting snapshot status") | ||
return snapshot.status(*args, **kwargs) | ||
Check warning on line 19 in TrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py Codecov / codecov/patchTrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py#L19
|