canonical / testflinger

https://testflinger.readthedocs.io/en/latest/
GNU General Public License v3.0
12 stars 20 forks source link

Write out the supervisord configs for all agents #351

Closed plars closed 2 months ago

plars commented 2 months ago

Description

To use supervisord for managing the agents, there will need to be a service file created for each agent. This is pretty simple to generate and looks basically like this: [program:] command=

Whenever the location of the configs is changed, or the action to update the configs is triggered, the charm should remove the existing configs under /etc/supervisord/conf.d, and then generate a new set of configs for all known agents.

The reason for this, is so that if any agents were removed, we ensure that the old agent is gone. This will be used for ensuring that we no longer run the service for a deleted agent.

Also, this branch now includes the parts that update the supervisord services when we rewrite them - this will launch any new agents that show up, and shut down any old ones that are removed. This will ONLY happen if there's an actual change to that supervisor conf file. i.e. it will NOT re-execute (update) the running service just because the identical file has been rewritten. This is important, because if it did, then it would shut it down immediately even if it was in the middle of a job.

So that means that we also have to handle the case of agents that have had possible updates to the config files for testflinger (not supervisor). Since there's a chance that could have happened to any of them, the safest course of action is to mark them all as needing a restart. This will use the signal mechanism in supervisor to tell all the agents to safely restart as soon as they are not running a test job.

Resolved issues

CERTTF-378 CERTTF-380

Documentation

This also added some features to make it easier to run and debug integration tests. Updated documentation for the agent host charm to include instructions for running the charm tests and debugging them.

Web service API changes

N/A

Tests

Added integration tests for this and fixed affected unit tests

plars commented 2 months ago

Updated to include CERTTF-380 - which is closely related to what was already in this branch anyway.

plars commented 2 months ago

A few more updates, like renaming the config options to keep them consistent with uses of - vs _. Also updated the README for the charm with additional details and operational tips.