Skip to content

[juju] Fix juju agent introspect commands#4013

Merged
TurboTurtle merged 1 commit into
sosreport:mainfrom
arif-ali:sos-arif-juju-agent-cmds
Jun 11, 2025
Merged

[juju] Fix juju agent introspect commands#4013
TurboTurtle merged 1 commit into
sosreport:mainfrom
arif-ali:sos-arif-juju-agent-cmds

Conversation

@arif-ali

Copy link
Copy Markdown
Member

By default the introspect commands are aliases in the bash login profile, so these won't be available via sos. This extraplotes the commands that are available and passes it to juju-introspect.


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

@arif-ali arif-ali added the Status/Canonical Eng Canonical Engineering has been requested to review label May 13, 2025
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4013
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

1 similar comment
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4013
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@arif-ali

Copy link
Copy Markdown
Member Author

seems like fedora 40 went EoL, this now depends on #4014 being merged

@arif-ali arif-ali force-pushed the sos-arif-juju-agent-cmds branch 2 times, most recently from 721c0cc to 0a62c4e Compare May 15, 2025 21:10
@arif-ali arif-ali marked this pull request as ready for review May 30, 2025 10:29
@arif-ali arif-ali added Kind/Ubuntu Ubuntu related item Status/Needs Review This issue still needs a review from project members and removed Status/Canonical Eng Canonical Engineering has been requested to review labels May 30, 2025
@arif-ali arif-ali force-pushed the sos-arif-juju-agent-cmds branch from 0a62c4e to e735b9b Compare June 3, 2025 11:48
@arif-ali

arif-ali commented Jun 3, 2025

Copy link
Copy Markdown
Member Author

/packit rebuild-failed

'juju_engine_report',
'juju_goroutines',
'juju_heap_profile',
'juju_leases',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You stop collecting this, is it intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The juju_leases alias doesn't exist anymore, plus it was very complex to bring it here in sos.

As this portion didn't work, it doesn't make much of a difference to actually remove it.

Comment thread sos/report/plugins/juju.py Outdated
Comment on lines +197 to +204
def _juju_agent(self, command):
agent_name = ""
for dir_name in self.listdir("/var/lib/juju/agents"):
if re.search('machine-*|controller-*|application-*', dir_name):
agent_name = dir_name
break

return f"juju-introspect --agent={agent_name} {command}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt it faster to store the agent_name in a variable and use it statically? Currently you call this method once for each juju_agents_cmds while you get a static info that can be fetched just once.

Or do I miss something?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, good catch, was trying to mimic a different version of the same thing and didn't really think about it too much. I'll get that updated

By default the introspect commands are aliases in the bash login
profile, so these won't be available via sos. This extraplotes the
commands that are available and passes it to juju-introspect.

Signed-off-by: Arif Ali <arif.ali@canonical.com>
@arif-ali arif-ali force-pushed the sos-arif-juju-agent-cmds branch from e735b9b to 4bad2e4 Compare June 10, 2025 07:59
@TurboTurtle TurboTurtle added Reviewed/Ready for Merge Has been reviewed, ready for merge Kind/Collection New or updated command or file collection and removed Status/Needs Review This issue still needs a review from project members labels Jun 11, 2025
@TurboTurtle TurboTurtle merged commit 820cfea into sosreport:main Jun 11, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind/Collection New or updated command or file collection Kind/Ubuntu Ubuntu related item Reviewed/Ready for Merge Has been reviewed, ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants