Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent use of colors for warning and error msgs in spawner #974

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions controller_manager/controller_manager/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,17 @@ def main(args=None):
if not wait_for_controller_manager(
node, controller_manager_name, controller_manager_timeout
):
node.get_logger().error("Controller manager not available")
node.get_logger().error(
bcolors.FAIL + "Controller manager not available" + bcolors.ENDC
)
return 1

if is_controller_loaded(node, controller_manager_name, prefixed_controller_name):
node.get_logger().warn("Controller already loaded, skipping load_controller")
node.get_logger().warn(
bcolors.WARNING
+ "Controller already loaded, skipping load_controller"
+ bcolors.ENDC
)
else:
if controller_type:
parameter = Parameter()
Expand Down Expand Up @@ -317,15 +323,19 @@ def main(args=None):
if not args.load_only:
ret = configure_controller(node, controller_manager_name, controller_name)
if not ret.ok:
node.get_logger().error("Failed to configure controller")
node.get_logger().error(
bcolors.FAIL + "Failed to configure controller" + bcolors.ENDC
)
return 1

if not args.inactive:
ret = switch_controllers(
node, controller_manager_name, [], [controller_name], True, True, 5.0
)
if not ret.ok:
node.get_logger().error("Failed to activate controller")
node.get_logger().error(
bcolors.FAIL + "Failed to activate controller" + bcolors.ENDC
)
return 1

node.get_logger().info(
Expand All @@ -350,14 +360,18 @@ def main(args=None):
node, controller_manager_name, [controller_name], [], True, True, 5.0
)
if not ret.ok:
node.get_logger().error("Failed to deactivate controller")
node.get_logger().error(
bcolors.FAIL + "Failed to deactivate controller" + bcolors.ENDC
)
return 1

node.get_logger().info("Deactivated controller")

ret = unload_controller(node, controller_manager_name, controller_name)
if not ret.ok:
node.get_logger().error("Failed to unload controller")
node.get_logger().error(
bcolors.FAIL + "Failed to unload controller" + bcolors.ENDC
)
return 1

node.get_logger().info("Unloaded controller")
Expand Down