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_general_preconfigure: false duplicates in /etc/hosts due to partial matching #696

Closed
ja9fuchs opened this issue Apr 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ja9fuchs
Copy link
Contributor

ja9fuchs commented Apr 11, 2024

Related to #132, but an issue on its own and while comments are not there on fresh end-to-end installations, the following is a problem that can occur anytime.

The awk search for duplicate IPs in /etc/hosts is not restricted to match the whole word. That leads to partial matches and a false error that ends the play and is an issue when IPs are randomly assigned during system deployment in a specified range, e.g. in cloud instances.

Example: IP check for 10.1.1.12 will conflict with an existing entry for 10.1.1.120.

File: roles/sap_general_preconfigure/tasks/RedHat/generic/assert-etc-hosts.yml

Code: awk 'BEGIN{a=0}/{{ sap_general_preconfigure_ip }}/{a++}END{print a}' /etc/hosts

Suggestion to only match the whole IP of an actual entry (no comment):
Add ^ and \s to indicate the word ending.
awk 'BEGIN{a=0}/^{{ sap_general_preconfigure_ip }}\s/{a++}END{print a}' /etc/hosts

Edit: \w didn't work for other entries, but \s does.

@ja9fuchs ja9fuchs added the bug Something isn't working label Apr 11, 2024
@berndfinger berndfinger self-assigned this Apr 11, 2024
@berndfinger
Copy link
Member

@ja9fuchs Thanks for reporting this. I already successfully tested with \s. See also

- name: Check for duplicate entries of {{ sap_ip }} in /etc/hosts
and
- name: Check for duplicate entries of {{ thishost.node_ip }}
.

berndfinger added a commit to berndfinger/community.sap_install that referenced this issue Apr 11, 2024
Solves issue sap-linuxlab#696.

Signed-off-by: Bernd Finger <bfinger@redhat.com>
berndfinger added a commit to berndfinger/community.sap_install that referenced this issue Apr 17, 2024
…address

Relates to sap-linuxlab#696.

Signed-off-by: Bernd Finger <bfinger@redhat.com>
berndfinger added a commit to berndfinger/community.sap_install that referenced this issue Apr 17, 2024
This speeds up processing and as a side effect reduces the number
of programming languages.

Relates to sap-linuxlab#696.

Signed-off-by: Bernd Finger <bfinger@redhat.com>
berndfinger added a commit to berndfinger/community.sap_install that referenced this issue Apr 17, 2024
Relates to sap-linuxlab#696.

Signed-off-by: Bernd Finger <bfinger@redhat.com>
@berndfinger
Copy link
Member

Fixed in #697, regression #736 fixed in #737.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants