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

Add provision_type field to agent data #183

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions agent/testflinger_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ def __init__(self, client):
def _post_initial_agent_data(self):
"""Post the initial agent data to the server once on agent startup"""

location = self.client.config.get("location", "")
self._post_advertised_queues()
self._post_advertised_images()

queues = self.client.config.get("job_queues", [])
identifier = self.client.config.get("identifier")
agent_data = {"queues": queues, "location": location}
location = self.client.config.get("location", "")
provision_type = self.client.config.get("provision_type", "")
queues = self.client.config.get("job_queues", [])

agent_data = {
"location": location,
"queues": queues,
"provision_type": provision_type,
}
if identifier:
agent_data["identifier"] = identifier

Expand Down
2 changes: 2 additions & 0 deletions agent/testflinger_agent/tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def agent(self, requests_mock):
"server_address": "127.0.0.1:8000",
"job_queues": ["test"],
"location": "nowhere",
"provision_type": "noprovision",
"execution_basedir": self.tmpdir,
"logging_basedir": self.tmpdir,
"results_basedir": os.path.join(self.tmpdir, "results"),
Expand Down Expand Up @@ -219,5 +220,6 @@ def test_post_agent_data(self, agent):
"identifier": self.config["identifier"],
"queues": self.config["job_queues"],
"location": self.config["location"],
"provision_type": self.config["provision_type"],
}
)
2 changes: 2 additions & 0 deletions server/src/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AgentIn(Schema):
state = fields.String(required=False)
queues = fields.List(fields.String(), required=False)
location = fields.String(required=False)
provision_type = fields.String(required=False)
omar-selo marked this conversation as resolved.
Show resolved Hide resolved
job_id = fields.String(required=False)
log = fields.List(fields.String(), required=False)

Expand All @@ -37,6 +38,7 @@ class AgentOut(Schema):
state = fields.String(required=False)
queues = fields.List(fields.String(), required=False)
location = fields.String(required=False)
provision_type = fields.String(required=False)
job_id = fields.String(required=False)


Expand Down
1 change: 1 addition & 0 deletions server/src/templates/agent_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Agent Name: {{ agent.name }}<br>
State: {{ agent.state }}<br>
Location: {{ agent.location }}<br>
Provision Type: {{ agent.provision_type }}<br>
Last Updated: {{ agent.updated_at.strftime('%Y-%m-%d %H:%M:%S') }}<br>
</p>
<p>
Expand Down
Loading