Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanhphan1147 committed Dec 13, 2023
1 parent cb85b2a commit 55ab100
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ def start(self) -> None:
"""Start the agent service."""
cache = snap.SnapCache()
agent = cache[SNAP_NAME]
credentials = self.state.agent_relation_credentials
if not credentials:
credentials = Credentials(address="", secret="")
agent.set(
{
"jenkins.token": credentials.secret,
"jenkins.url": credentials.address,
"jenkins.agent": self.state.agent_meta.name,
}
)
if credentials := self.state.agent_relation_credentials:
agent.set(
{
"jenkins.token": credentials.secret,
"jenkins.url": credentials.address,
"jenkins.agent": self.state.agent_meta.name,
}
)
agent.start()

def stop(self) -> None:
Expand Down

0 comments on commit 55ab100

Please sign in to comment.