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

Fix detection of KRA installation so upgrades can succeed #1517

Closed
wants to merge 1 commit into from

Conversation

rcritten
Copy link
Contributor

@rcritten rcritten commented Feb 4, 2018

To determine whether KRA needs to be updated the standard
service.is_configured() was used. Since the KRA and CA share
the same service name (pki-tomcatd) this wasn't being detected
properly.

Add an additional check to see if the KRA CS.cfg is present.

https://pagure.io/freeipa/issue/7389

Signed-off-by: Rob Crittenden rcritten@redhat.com

@stlaz
Copy link
Contributor

stlaz commented Feb 5, 2018

I recently noticed this failure, too. When did it start to happen?

@flo-renaud
Copy link
Contributor

Hi @rcritten
you could also replace the call to kra.is_configured() with kra.is_installed() since is_installed properly checks for the subsystem.
I quickly checked the tests and we currently have no test at all using ipa-server-upgrade. This fix would be a good opportunity to enhance the test suite and add a simple test calling install + ipa-server-upgrade.

@stlaz
Copy link
Contributor

stlaz commented Feb 5, 2018

Hm, must have been there from the start of the check given that the configuration of the service is decided on sstore content for the service_name of the caller class, and service_name for both CAInstance and KRAInstance is pki-tomcatd.
To do this properly, you should probably rather implement is_configured in DogtagInstance and base it on cls.config_file, where config_file would be set in each of the classes __init__() method.

+1 for the test

edit: the config variable is actually already there.
edit: or use suggestion from @flo-renaud, I run through the first part of the comment way too fast, sorry.

@rcritten
Copy link
Contributor Author

rcritten commented Feb 5, 2018

Implemented Flo's suggestions.

Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @rcritten
thank you for the new PR. The commit properly fixes the issue but I have an inline comment for the test.


def test_invoke_upgrader(self):
# For a new version in to require the upgrade to run
sysupgrade.set_upgrade_state('ipa', 'data_version',
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm mistaken, this command would be run on the controller from where the tests are launched (which can be different from the master) and will trigger an error.
Moreover, I don't think you need to tweak the data_version for ipa-server-upgrade to run, the upgrade can be executed even without changing the version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, of course. My purpose was to be absolutely sure that the upgrade was successful. I can remove this and revisit in the future if need be.

@@ -1710,7 +1710,7 @@ def upgrade_configuration():
)
upgrade_pki(ca, fstore)

if kra.is_configured():
if kra.is_installed():
Copy link
Contributor

Choose a reason for hiding this comment

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

18 lines below there's a very similar check, you should probably change that one, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, done.


from ipatests.test_integration.base import IntegrationTest
from ipatests.pytest_plugins.integration import tasks
from ipaserver.install import sysupgrade
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sigh, it's what I get for rushing. Fixed.

@flo-renaud
Copy link
Contributor

Hi @rcritten
I tested the fix with an install of server without kra, followed by ipa-server-upgrade, and it proceeded smoothly.
I was also able to launch the integration test successfully.

I'm just waiting for the PR-CI success to give the ACK.

@stlaz
Copy link
Contributor

stlaz commented Feb 7, 2018

PR CI build fails with No matching package to install: 'python2-ldap >= 2.4.15'

@felipevolpone
Copy link
Member

Probably PR needs a rebase

Use is_installed() instead of is_configured() because
is_installed() does a config file check to see if the service
is in use.

https://pagure.io/freeipa/issue/7389

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
@flo-renaud
Copy link
Contributor

Now that the tests are green, ACK

@flo-renaud flo-renaud added the ack Pull Request approved, can be merged label Feb 8, 2018
@tiran tiran added the pushed Pull Request has already been pushed label Feb 8, 2018
@tiran
Copy link
Member

tiran commented Feb 8, 2018

master:

  • 8821f7a Fix detection of KRA installation so upgrades can succeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
5 participants