Skip to content

Commit 83ebced

Browse files
authoredJan 10, 2024
Merge pull request #183 from canonical/provision-type-in-agent-data
Add provision_type field to agent data
2 parents 17c83c7 + 4f9d356 commit 83ebced

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed
 

‎agent/testflinger_agent/agent.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ def __init__(self, client):
3232
def _post_initial_agent_data(self):
3333
"""Post the initial agent data to the server once on agent startup"""
3434

35-
location = self.client.config.get("location", "")
3635
self._post_advertised_queues()
3736
self._post_advertised_images()
3837

39-
queues = self.client.config.get("job_queues", [])
4038
identifier = self.client.config.get("identifier")
41-
agent_data = {"queues": queues, "location": location}
39+
location = self.client.config.get("location", "")
40+
provision_type = self.client.config.get("provision_type", "")
41+
queues = self.client.config.get("job_queues", [])
42+
43+
agent_data = {
44+
"location": location,
45+
"queues": queues,
46+
"provision_type": provision_type,
47+
}
4248
if identifier:
4349
agent_data["identifier"] = identifier
4450

‎agent/testflinger_agent/tests/test_agent.py

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def agent(self, requests_mock):
2525
"server_address": "127.0.0.1:8000",
2626
"job_queues": ["test"],
2727
"location": "nowhere",
28+
"provision_type": "noprovision",
2829
"execution_basedir": self.tmpdir,
2930
"logging_basedir": self.tmpdir,
3031
"results_basedir": os.path.join(self.tmpdir, "results"),
@@ -219,5 +220,6 @@ def test_post_agent_data(self, agent):
219220
"identifier": self.config["identifier"],
220221
"queues": self.config["job_queues"],
221222
"location": self.config["location"],
223+
"provision_type": self.config["provision_type"],
222224
}
223225
)

‎server/src/api/schemas.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AgentIn(Schema):
2727
state = fields.String(required=False)
2828
queues = fields.List(fields.String(), required=False)
2929
location = fields.String(required=False)
30+
provision_type = fields.String(required=False)
3031
job_id = fields.String(required=False)
3132
log = fields.List(fields.String(), required=False)
3233

@@ -37,6 +38,7 @@ class AgentOut(Schema):
3738
state = fields.String(required=False)
3839
queues = fields.List(fields.String(), required=False)
3940
location = fields.String(required=False)
41+
provision_type = fields.String(required=False)
4042
job_id = fields.String(required=False)
4143

4244

‎server/src/templates/agent_detail.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Agent Name: {{ agent.name }}<br>
77
State: {{ agent.state }}<br>
88
Location: {{ agent.location }}<br>
9+
Provision Type: {{ agent.provision_type }}<br>
910
Last Updated: {{ agent.updated_at.strftime('%Y-%m-%d %H:%M:%S') }}<br>
1011
</p>
1112
<p>

0 commit comments

Comments
 (0)