-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pythonize "rookify" application (#22)
Signed-off-by: Tobias Wolf <[email protected]> Co-authored-by: Jan-Marten Brüggemann <[email protected]>
- Loading branch information
1 parent
7ea96af
commit 915e296
Showing
13 changed files
with
74 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
4 changes: 3 additions & 1 deletion
4
src/modules/analyze_ceph/__init__.py → src/rookify/modules/analyze_ceph/__init__.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,6 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .main import AnalyzeCephHandler | ||
|
||
HANDLER_CLASS = AnalyzeCephHandler | ||
RUN_IN_PREFLIGHT = True | ||
REQUIRES = [] | ||
AFTER = [] | ||
AFTER = [] |
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
4 changes: 3 additions & 1 deletion
4
src/modules/example/__init__.py → src/rookify/modules/example/__init__.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,6 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .main import ExampleHandler | ||
|
||
HANDLER_CLASS = ExampleHandler # Define the handler class for this module | ||
RUN_IN_PREFLIGHT = False # This executes the run method during preflight checks. This is neccessary for analyze modules. | ||
REQUIRES = ['analyze_ceph'] # A list of modules that are required to run before this module. Modules in this list will be imported, even if they are not configured | ||
AFTER = ['migrate_monitors'] # A list of modules that should be run before this module, if they are defined in config | ||
AFTER = ['migrate_monitors'] # A list of modules that should be run before this module, if they are defined in config |
8 changes: 5 additions & 3 deletions
8
src/modules/example/main.py → src/rookify/modules/example/main.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,11 +1,13 @@ | ||
from modules.module import ModuleHandler, ModuleException | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..module import ModuleHandler, ModuleException | ||
|
||
class ExampleHandler(ModuleHandler): | ||
|
||
def preflight_check(self): | ||
# Do something for checking if all needed preconditions are met else throw ModuleException | ||
raise ModuleException('Example module was loaded, so aborting!') | ||
|
||
def run(self) -> dict: | ||
# Run the migration tasks | ||
pass | ||
pass |
4 changes: 3 additions & 1 deletion
4
src/modules/migrate_monitors/__init__.py → ...kify/modules/migrate_monitors/__init__.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,6 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .main import MigrateMonitorsHandler | ||
|
||
HANDLER_CLASS = MigrateMonitorsHandler | ||
RUN_IN_PREFLIGHT = False | ||
REQUIRES = ['analyze_ceph'] | ||
AFTER = [] | ||
AFTER = [] |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..module import ModuleHandler | ||
|
||
class MigrateMonitorsHandler(ModuleHandler): | ||
pass |
4 changes: 3 additions & 1 deletion
4
src/modules/migrate_osds/__init__.py → src/rookify/modules/migrate_osds/__init__.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,6 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .main import MigrateOSDsHandler | ||
|
||
HANDLER_CLASS = MigrateOSDsHandler | ||
RUN_IN_PREFLIGHT = False | ||
REQUIRES = ['analyze_ceph'] | ||
AFTER = ['migrate_monitors'] | ||
AFTER = ['migrate_monitors'] |
8 changes: 5 additions & 3 deletions
8
src/modules/migrate_osds/main.py → src/rookify/modules/migrate_osds/main.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import yaml | ||
|
||
def load_yaml(path: str) -> dict: | ||
with open(path, 'r') as file: | ||
return yaml.safe_load(file) | ||
|
||
def save_yaml(path: str, data: dict) -> None: | ||
with open(path, 'w') as file: | ||
yaml.safe_dump(data, file) |