[ipa/server] Change how the check for ipa-replica-install is being done #2281

Merged
ryanlerch merged 1 commit from ipa into main 2024-10-07 10:38:05 +00:00
Contributor

As found on in https://pagure.io/fedora-infrastructure/issue/12149 the current
method of checking if the ipa-replica-install have to be executed is not
reliable enough.

Let's instead check for log file that is created during the installation. This
will need manual intervention in case the ipa-replica-install needs to be run
again, but it will be much more reliable otherwise.

Signed-off-by: Michal Konecny mkonecny@redhat.com

As found on in https://pagure.io/fedora-infrastructure/issue/12149 the current method of checking if the ipa-replica-install have to be executed is not reliable enough. Let's instead check for log file that is created during the installation. This will need manual intervention in case the ipa-replica-install needs to be run again, but it will be much more reliable otherwise. Signed-off-by: Michal Konecny <mkonecny@redhat.com>
First-time contributor
Build succeeded. https://fedora.softwarefactory-project.io/zuul/buildset/059a07e9cb1e4caa93c8b5c7ad45fd13 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/c849914c6c2942579c53489a40f97e3a) : SUCCESS in 3m 49s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/ab5d3076079a48b9b7272c52295b170b) : SUCCESS in 2m 32s
Contributor

Hum... so that file exists after a server install?

But this means this would run on every run... we only want it to run if that file 'doesn't' exist?

Also, thinking about it, perhaps we could also add a prompt:

  • name: ask admin if they are ok reinstalling this ipa server replica
    pause: prompt="Looks like this replica should be reinstalled, are you sure you want to do that?"
Hum... so that file exists after a server install? But this means this would run on every run... we only want it to run if that file 'doesn't' exist? Also, thinking about it, perhaps we could also add a prompt: - name: ask admin if they are ok reinstalling this ipa server replica pause: prompt="Looks like this replica should be reinstalled, are you sure you want to do that?"
Author
Contributor

Now that I'm looking I should check if the file doesn't exist as it's created by ipa-replica-install. Let me change the logic.

I can add the prompt as well.

Now that I'm looking I should check if the file doesn't exist as it's created by ipa-replica-install. Let me change the logic. I can add the prompt as well.
Author
Contributor

1 new commit added

  • [ipa/server] Add confirmation prompt for ipa-replica-install
**1 new commit added** * ``[ipa/server] Add confirmation prompt for ipa-replica-install``
First-time contributor
Build succeeded. https://fedora.softwarefactory-project.io/zuul/buildset/f0d9550ee3954ba894772c3bfd6cb122 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/5b6f3704a6744ab8b8064fc9a4754037) : SUCCESS in 3m 50s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/19970be12b5e483b99538854fce5caa0) : SUCCESS in 2m 29s
Author
Contributor

2 new commits added

  • [ipa/server] Add confirmation prompt for ipa-replica-install
  • [ipa/server] Change how the check for ipa-replica-install is being done
**2 new commits added** * ``[ipa/server] Add confirmation prompt for ipa-replica-install`` * ``[ipa/server] Change how the check for ipa-replica-install is being done``
First-time contributor
Build succeeded. https://fedora.softwarefactory-project.io/zuul/buildset/8021ec7e96ff4be4af25611337438ad9 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/b5b221e17746417a97207d45a977dc6f) : SUCCESS in 3m 46s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/139aa84088de4e31a910b1c975860bf0) : SUCCESS in 2m 33s
Contributor

This looks good to me now.

Perhaps we should merge this and run it over staging to make sure all is well there?

This looks good to me now. Perhaps we should merge this and run it over staging to make sure all is well there?
Author
Contributor

I will do it today.

I will do it today.
Author
Contributor

rebased onto 58f8c45973

rebased onto 58f8c4597318f238ffffa874c9525d52a5995c50
Author
Contributor

rebased onto 58f8c45973

rebased onto 58f8c4597318f238ffffa874c9525d52a5995c50
First-time contributor
Build succeeded. https://fedora.softwarefactory-project.io/zuul/buildset/78bde42d6e4c4f6194ede239a4e63198 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/36aa082634c6418fa10a2902f331d55c) : SUCCESS in 4m 16s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/88a0f9d5565043578c991cbaaf630200) : SUCCESS in 2m 48s
Author
Contributor

Pull-Request has been merged by zlopez

Pull-Request has been merged by zlopez
Author
Contributor

The playbook seems to work OK, I wasn't even prompted as the file I'm checking is already there.

I just saw this error, so I will look at that:

fatal: [ipa01.stg.iad2.fedoraproject.org]: FAILED! => {"msg": "The conditional check '(confirm_replica is defined) and (confirm_replica.user_input | bool)' failed. The error was: error while evaluating conditional ((confirm_replica is defined) and (confirm_replica.user_input | bool)): 'dict object' has no attribute 'user_input'. 'dict object' has no attribute 'user_input'\n\nThe error appears to be in '/srv/web/infra/ansible/roles/ipa/server/tasks/main.yml': line 122, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n    # the replica to be deployed.\n  - name: clean client installation\n    ^ here\n"}

It seems that this is being checked for ipa01 as well, which is wrong as the prompt is actually skipped. I will check what happened and produce a fix.

The playbook seems to work OK, I wasn't even prompted as the file I'm checking is already there. I just saw this error, so I will look at that: ``` fatal: [ipa01.stg.iad2.fedoraproject.org]: FAILED! => {"msg": "The conditional check '(confirm_replica is defined) and (confirm_replica.user_input | bool)' failed. The error was: error while evaluating conditional ((confirm_replica is defined) and (confirm_replica.user_input | bool)): 'dict object' has no attribute 'user_input'. 'dict object' has no attribute 'user_input'\n\nThe error appears to be in '/srv/web/infra/ansible/roles/ipa/server/tasks/main.yml': line 122, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # the replica to be deployed.\n - name: clean client installation\n ^ here\n"} ``` It seems that this is being checked for ipa01 as well, which is wrong as the prompt is actually skipped. I will check what happened and produce a fix.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Infrastructure/ansible#2281
No description provided.