daemon: added capability to config services to shadow directory structures, from a given path, or from a local source, files may be templates or a straight copy and can be sourced from node named unique paths for node specific files, also refactored and renamed file creation related functions for nodes
This commit is contained in:
parent
b96dc621cd
commit
bd896d1336
10 changed files with 212 additions and 130 deletions
|
@ -60,7 +60,7 @@ def patcher(request):
|
|||
patch_manager.patch_obj(
|
||||
LinuxNetClient, "get_mac", return_value="00:00:00:00:00:00"
|
||||
)
|
||||
patch_manager.patch_obj(CoreNode, "nodefile")
|
||||
patch_manager.patch_obj(CoreNode, "create_file")
|
||||
patch_manager.patch_obj(Session, "write_state")
|
||||
patch_manager.patch_obj(Session, "write_nodes")
|
||||
yield patch_manager
|
||||
|
|
|
@ -70,7 +70,7 @@ class TestConfigServices:
|
|||
|
||||
# then
|
||||
directory = Path(MyService.directories[0])
|
||||
node.privatedir.assert_called_with(directory)
|
||||
node.create_dir.assert_called_with(directory)
|
||||
|
||||
def test_create_files_custom(self):
|
||||
# given
|
||||
|
@ -84,7 +84,7 @@ class TestConfigServices:
|
|||
|
||||
# then
|
||||
file_path = Path(MyService.files[0])
|
||||
node.nodefile.assert_called_with(file_path, text)
|
||||
node.create_file.assert_called_with(file_path, text)
|
||||
|
||||
def test_create_files_text(self):
|
||||
# given
|
||||
|
@ -96,7 +96,7 @@ class TestConfigServices:
|
|||
|
||||
# then
|
||||
file_path = Path(MyService.files[0])
|
||||
node.nodefile.assert_called_with(file_path, TEMPLATE_TEXT)
|
||||
node.create_file.assert_called_with(file_path, TEMPLATE_TEXT)
|
||||
|
||||
def test_run_startup(self):
|
||||
# given
|
||||
|
|
|
@ -441,10 +441,8 @@ class TestGui:
|
|||
coretlv.handle_message(message)
|
||||
|
||||
if not request.config.getoption("mock"):
|
||||
directory = str(file_path.parent)
|
||||
created_directory = directory[1:].replace("/", ".")
|
||||
create_path = node.directory / created_directory / file_path.name
|
||||
assert create_path.exists()
|
||||
expected_path = node.directory / "var.log/test" / file_path.name
|
||||
assert expected_path.exists()
|
||||
|
||||
def test_exec_node_tty(self, coretlv: CoreHandler):
|
||||
coretlv.dispatch_replies = mock.MagicMock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue