-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andre Kurait <akurait@amazon.com>
- Loading branch information
1 parent
2a45284
commit ae734ee
Showing
5 changed files
with
145 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 6 additions & 11 deletions
17
...Solution/src/main/docker/migrationConsole/lib/console_link/console_link/logic/snapshot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
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}") | ||
|
||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 86 additions & 1 deletion
87
...e/dockerSolution/src/main/docker/migrationConsole/lib/console_link/tests/test_snapshot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters