added files/directories to grpc set_node_service

This commit is contained in:
Blake Harnden 2020-02-14 13:40:10 -08:00
parent 71aeb98bb9
commit ebafa228ff
6 changed files with 34 additions and 14 deletions

View file

@ -834,9 +834,11 @@ class CoreGrpcClient:
session_id: int,
node_id: int,
service: str,
startup: List[str],
validate: List[str],
shutdown: List[str],
files: List[str] = None,
directories: List[str] = None,
startup: List[str] = None,
validate: List[str] = None,
shutdown: List[str] = None,
) -> core_pb2.SetNodeServiceResponse:
"""
Set service data for a node.
@ -844,6 +846,8 @@ class CoreGrpcClient:
:param session_id: session id
:param node_id: node id
:param service: service name
:param files: service files
:param directories: service directories
:param startup: startup commands
:param validate: validation commands
:param shutdown: shutdown commands
@ -853,6 +857,8 @@ class CoreGrpcClient:
config = core_pb2.ServiceConfig(
node_id=node_id,
service=service,
files=files,
directories=directories,
startup=startup,
validate=validate,
shutdown=shutdown,

View file

@ -376,8 +376,15 @@ def service_configuration(session: Session, config: core_pb2.ServiceConfig) -> N
"""
session.services.set_service(config.node_id, config.service)
service = session.services.get_service(config.node_id, config.service)
if config.files:
service.files = tuple(config.files)
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)

View file

@ -625,7 +625,12 @@ class CoreClient:
shutdowns: List[str],
) -> core_pb2.NodeServiceData:
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(
"Set %s service for node(%s), Startup: %s, Validation: %s, Shutdown: %s, Result: %s",
@ -713,9 +718,9 @@ class CoreClient:
self.session_id,
config_proto.node_id,
config_proto.service,
config_proto.startup,
config_proto.validate,
config_proto.shutdown,
startup=config_proto.startup,
validate=config_proto.validate,
shutdown=config_proto.shutdown,
)
for config_proto in self.get_service_file_configs_proto():
self.client.set_node_service_file(

View file

@ -426,9 +426,9 @@ class ServiceConfigDialog(Dialog):
config = self.core.set_node_service(
self.node_id,
self.service_name,
startup_commands,
validate_commands,
shutdown_commands,
startups=startup_commands,
validations=validate_commands,
shutdowns=shutdown_commands,
)
if self.node_id not in self.service_configs:
self.service_configs[self.node_id] = {}

View file

@ -771,6 +771,8 @@ message ServiceConfig {
repeated string startup = 3;
repeated string validate = 4;
repeated string shutdown = 5;
repeated string files = 6;
repeated string directories = 7;
}
message ServiceFileConfig {

View file

@ -935,7 +935,7 @@ class TestGrpc:
# then
with client.context_connect():
response = client.set_node_service(
session.id, node.id, service_name, [], validate, []
session.id, node.id, service_name, validate=validate
)
# then