added files/directories to grpc set_node_service
This commit is contained in:
parent
71aeb98bb9
commit
ebafa228ff
6 changed files with 34 additions and 14 deletions
|
@ -834,9 +834,11 @@ class CoreGrpcClient:
|
||||||
session_id: int,
|
session_id: int,
|
||||||
node_id: int,
|
node_id: int,
|
||||||
service: str,
|
service: str,
|
||||||
startup: List[str],
|
files: List[str] = None,
|
||||||
validate: List[str],
|
directories: List[str] = None,
|
||||||
shutdown: List[str],
|
startup: List[str] = None,
|
||||||
|
validate: List[str] = None,
|
||||||
|
shutdown: List[str] = None,
|
||||||
) -> core_pb2.SetNodeServiceResponse:
|
) -> core_pb2.SetNodeServiceResponse:
|
||||||
"""
|
"""
|
||||||
Set service data for a node.
|
Set service data for a node.
|
||||||
|
@ -844,6 +846,8 @@ class CoreGrpcClient:
|
||||||
:param session_id: session id
|
:param session_id: session id
|
||||||
:param node_id: node id
|
:param node_id: node id
|
||||||
:param service: service name
|
:param service: service name
|
||||||
|
:param files: service files
|
||||||
|
:param directories: service directories
|
||||||
:param startup: startup commands
|
:param startup: startup commands
|
||||||
:param validate: validation commands
|
:param validate: validation commands
|
||||||
:param shutdown: shutdown commands
|
:param shutdown: shutdown commands
|
||||||
|
@ -853,6 +857,8 @@ class CoreGrpcClient:
|
||||||
config = core_pb2.ServiceConfig(
|
config = core_pb2.ServiceConfig(
|
||||||
node_id=node_id,
|
node_id=node_id,
|
||||||
service=service,
|
service=service,
|
||||||
|
files=files,
|
||||||
|
directories=directories,
|
||||||
startup=startup,
|
startup=startup,
|
||||||
validate=validate,
|
validate=validate,
|
||||||
shutdown=shutdown,
|
shutdown=shutdown,
|
||||||
|
|
|
@ -376,9 +376,16 @@ def service_configuration(session: Session, config: core_pb2.ServiceConfig) -> N
|
||||||
"""
|
"""
|
||||||
session.services.set_service(config.node_id, config.service)
|
session.services.set_service(config.node_id, config.service)
|
||||||
service = session.services.get_service(config.node_id, config.service)
|
service = session.services.get_service(config.node_id, config.service)
|
||||||
service.startup = tuple(config.startup)
|
if config.files:
|
||||||
service.validate = tuple(config.validate)
|
service.files = tuple(config.files)
|
||||||
service.shutdown = tuple(config.shutdown)
|
if config.directories:
|
||||||
|
service.directories = tuple(config.directories)
|
||||||
|
if config.startup:
|
||||||
|
service.startup = tuple(config.startup)
|
||||||
|
if config.validate:
|
||||||
|
service.validate = tuple(config.validate)
|
||||||
|
if config.shutdown:
|
||||||
|
service.shutdown = tuple(config.shutdown)
|
||||||
|
|
||||||
|
|
||||||
def get_service_configuration(service: Type[CoreService]) -> core_pb2.NodeServiceData:
|
def get_service_configuration(service: Type[CoreService]) -> core_pb2.NodeServiceData:
|
||||||
|
|
|
@ -625,7 +625,12 @@ class CoreClient:
|
||||||
shutdowns: List[str],
|
shutdowns: List[str],
|
||||||
) -> core_pb2.NodeServiceData:
|
) -> core_pb2.NodeServiceData:
|
||||||
response = self.client.set_node_service(
|
response = self.client.set_node_service(
|
||||||
self.session_id, node_id, service_name, startups, validations, shutdowns
|
self.session_id,
|
||||||
|
node_id,
|
||||||
|
service_name,
|
||||||
|
startup=startups,
|
||||||
|
validate=validations,
|
||||||
|
shutdown=shutdowns,
|
||||||
)
|
)
|
||||||
logging.info(
|
logging.info(
|
||||||
"Set %s service for node(%s), Startup: %s, Validation: %s, Shutdown: %s, Result: %s",
|
"Set %s service for node(%s), Startup: %s, Validation: %s, Shutdown: %s, Result: %s",
|
||||||
|
@ -713,9 +718,9 @@ class CoreClient:
|
||||||
self.session_id,
|
self.session_id,
|
||||||
config_proto.node_id,
|
config_proto.node_id,
|
||||||
config_proto.service,
|
config_proto.service,
|
||||||
config_proto.startup,
|
startup=config_proto.startup,
|
||||||
config_proto.validate,
|
validate=config_proto.validate,
|
||||||
config_proto.shutdown,
|
shutdown=config_proto.shutdown,
|
||||||
)
|
)
|
||||||
for config_proto in self.get_service_file_configs_proto():
|
for config_proto in self.get_service_file_configs_proto():
|
||||||
self.client.set_node_service_file(
|
self.client.set_node_service_file(
|
||||||
|
|
|
@ -426,9 +426,9 @@ class ServiceConfigDialog(Dialog):
|
||||||
config = self.core.set_node_service(
|
config = self.core.set_node_service(
|
||||||
self.node_id,
|
self.node_id,
|
||||||
self.service_name,
|
self.service_name,
|
||||||
startup_commands,
|
startups=startup_commands,
|
||||||
validate_commands,
|
validations=validate_commands,
|
||||||
shutdown_commands,
|
shutdowns=shutdown_commands,
|
||||||
)
|
)
|
||||||
if self.node_id not in self.service_configs:
|
if self.node_id not in self.service_configs:
|
||||||
self.service_configs[self.node_id] = {}
|
self.service_configs[self.node_id] = {}
|
||||||
|
|
|
@ -771,6 +771,8 @@ message ServiceConfig {
|
||||||
repeated string startup = 3;
|
repeated string startup = 3;
|
||||||
repeated string validate = 4;
|
repeated string validate = 4;
|
||||||
repeated string shutdown = 5;
|
repeated string shutdown = 5;
|
||||||
|
repeated string files = 6;
|
||||||
|
repeated string directories = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ServiceFileConfig {
|
message ServiceFileConfig {
|
||||||
|
|
|
@ -935,7 +935,7 @@ class TestGrpc:
|
||||||
# then
|
# then
|
||||||
with client.context_connect():
|
with client.context_connect():
|
||||||
response = client.set_node_service(
|
response = client.set_node_service(
|
||||||
session.id, node.id, service_name, [], validate, []
|
session.id, node.id, service_name, validate=validate
|
||||||
)
|
)
|
||||||
|
|
||||||
# then
|
# then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue