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

sap_facts.sh - ps print only executable with path #28

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

jhohwieler
Copy link

@jhohwieler jhohwieler commented Aug 19, 2024

I was wondering why the gathering of SAP facts was unstable. While digging through the sap_facts.sh script, I've figured that there is an issue with the ps command output. The name of the SAP instances, like 00 or 01 etc., can interfere with the process age or even with arguments.

I had to revise my code change. At first I used "ps -eo command" to prevent any interference with the process age. But later I figured it can also interfere with arguments. So I revised my patch to use "ps -eo exe".

collection: merge dev to main for release 0.9.1
collection: merge dev to main for release 0.9.1 fix
@jhohwieler jhohwieler force-pushed the sap_facts.sh-ps-command-column branch 2 times, most recently from 9140fd1 to 46d9216 Compare August 20, 2024 09:21
@jhohwieler jhohwieler changed the title sap_facts.sh - print only command column with ps sap_facts.sh - ps print only executable with path Aug 20, 2024
The output of "ps -ef" not also includes the command but also the
process age and process arguments. Both can have digits in its string
which may interfere when grepping for an instance number like 00 or 01.

To fix this, let ps print only the executable with its path.

Example: ps with default output - 2 lines match where only 1st line should match
/usr/sap/A22/D01/exe/sapstartsrv pf=/usr/sap/A22/SYS/profile/A22_D01_sapa22u01 -D -u a22adm
/usr/sap/A22/ASCS02/exe/sapstartsrv pf=/usr/sap/A22/SYS/profile/A22_ASCS02_sapa22u01 -D -u a22adm

Example: ps with custom layout, only one line matches as expected
/usr/sap/A22/D01/exe/sapstartsrv
@jhohwieler jhohwieler force-pushed the sap_facts.sh-ps-command-column branch from 46d9216 to 8ee8993 Compare August 20, 2024 09:25
@Wabri Wabri changed the base branch from main to dev August 20, 2024 11:35
@jhohwieler
Copy link
Author

It's almost two months ago since I opened this pull request. Is there a timeline to get this change mainline?

Copy link
Collaborator

@rainerleber rainerleber left a comment

Choose a reason for hiding this comment

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

lgtm

maybe you should have a look at community.sap_libs.sap_system_facts

https://docs.ansible.com/ansible/latest/collections/community/sap_libs/sap_system_facts_module.html

@kksat
Copy link

kksat commented Oct 18, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants