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

6.9 -> 7.4 migration fixes #741

Closed
wants to merge 2 commits into from
Closed

6.9 -> 7.4 migration fixes #741

wants to merge 2 commits into from

Conversation

stlaz
Copy link
Contributor

@stlaz stlaz commented Apr 27, 2017

Allow rewriting of cached properties

Cached property should not be treated anyway special from a normal
property. If we need to rewrite/remove it, we should be able to do
just so.

Refresh Dogtag RestClient.ca_host property

Refresh the ca_host property of the Dogtag's RestClient class when
it's requested as a context manager.

This solves the problem which would occur on DL0 when installing
CA against an old master which does not have port 8443 accessible.
The setup tries to update the cert profiles via this port but
fail. This operation should be performed against the local instance
anyway.

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

@stlaz stlaz changed the title Migration 6.9 -> 7.4 migration fixes Apr 27, 2017
ipalib/util.py Outdated
@@ -520,10 +520,8 @@ def __get__(self, obj, cls):
return self.store[obj]

def __set__(self, obj, value):
raise AttributeError("can't set attribute")
self.store[obj] = value
Copy link
Member

Choose a reason for hiding this comment

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

If you are going to turn the cached property into a writeable and deletable property, then you can remove the complicated weakref stuff and replace it with a simple non-data descriptor:

class cachedproperty(object):
    slots = ('fget',)
    def __init__(self, fget):
        self.fget = fget
    def __get__(self, obj, objtype=None):
        if obj is None:
            return self
        value = self.fget(obj)
        setattr(obj, self.fget.__name__, value)
        return value

Copy link
Member

Choose a reason for hiding this comment

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

ah, and add self.__doc__ = fget.__doc__.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided to go with a simpler approach, pylint was a hater anyway.

@pvoborni pvoborni added the prioritized Pull Request has higher priority for PR-CI label Apr 28, 2017
@stlaz
Copy link
Contributor Author

stlaz commented Apr 28, 2017

For the record - the tests are passing on my machine, etwas stimmt hier nicht.

"""
if self._ca_host is not None:
return self._ca_host
Copy link
Member

Choose a reason for hiding this comment

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

yeah, that's simpler 👍

@stlaz stlaz force-pushed the migration branch 2 times, most recently from 1ccd4c1 to 225fc31 Compare May 2, 2017 09:36
@MartinBasti MartinBasti self-assigned this May 2, 2017
@MartinBasti
Copy link
Contributor

It failed to me

  [20/28]: Configure HTTP to proxy connections
  [21/28]: restarting certificate server
  [22/28]: migrating certificate profiles to LDAP
  [error] NetworkError: cannot connect to 'https://vm-058-166.abc.idm.lab.eng.brq.redhat.com:8443/ca/rest/account/login': [Errno 111] Connection refused
Your system may be partly configured.

@stlaz
Copy link
Contributor Author

stlaz commented May 2, 2017

This was supposed to be fixed by the patch and worked for me, it seems that I may need to investigate it further.

stlaz added 2 commits May 2, 2017 15:11
Refresh the ca_host property of the Dogtag's RestClient class when
it's requested as a context manager.

This solves the problem which would occur on DL0 when installing
CA which needs to perform a set of steps against itself accessing
8443 port. This port should however only be available locally so
trying to connect to remote master would fail. We need to make
sure the right CA host is accessed.

https://pagure.io/freeipa/issue/6878
The cachedproperty class was used in one special use-case where it only
caused issues. Let's get rid of it.

https://pagure.io/freeipa/issue/6878
@stlaz
Copy link
Contributor Author

stlaz commented May 2, 2017

Turns out I forgot to reorder the CA installation steps a bit.

@MartinBasti MartinBasti added ack Pull Request approved, can be merged pushed Pull Request has already been pushed labels May 2, 2017
@MartinBasti
Copy link
Contributor

master:

  • 0d406fc Refresh Dogtag RestClient.ca_host property
  • 92313c9 Remove the cachedproperty class

ipa-4-5:

  • 32981a0 Refresh Dogtag RestClient.ca_host property
  • 9de3439 Remove the cachedproperty class

@MartinBasti MartinBasti closed this May 2, 2017
@stlaz stlaz deleted the migration branch July 7, 2017 12:16
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 prioritized Pull Request has higher priority for PR-CI pushed Pull Request has already been pushed
Projects
None yet
4 participants