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

Do not build the local provider by default #611

Closed
wants to merge 16 commits into from

Conversation

fidencio
Copy link
Contributor

@fidencio fidencio commented Jul 2, 2018

Folks,

This series is the first attempt to avoid building the local provider by default. With we only build it conditionally and the default is set to not build it. The problems:

  • integration tests depend on the local provider: For this, I've changed our configure line, specifying to enable the local provider;
  • some unit tests depend on local provider: I've changed some tests (please, take a careful look at those in order to be sure I'm not invalidating the tests) and worked them around so they're still valid with both scenarios (building or not building the local provider);

My personal preference would be to start using the files provider in our tests instead of using the "local" one. However, I've faced some issues related to the amount of users being find in some sysdb tests (ping me, we can discuss this either here or in the #sssd channel) (maybe because it also finds the local users/groups created on my machine?).

Again, this is a first attempt, let's discuss improvements needed :-)

@pbrezina
Copy link
Member

pbrezina commented Jul 2, 2018

My personal preference would be to start using the files provider in our tests instead of using the "local" one. However, I've faced some issues related to the amount of users being find in some sysdb tests (ping me, we can discuss this either here or in the #sssd channel) (maybe because it also finds the local users/groups created on my machine?).

Good idea. How did you configure the files provider? You can you passwd_files and group_files to set the files you want to read, also you can use SSS_FILES_PASSWD and SSS_FILES_GROUP environment variable to overwrite standard file names.

@jhrozek
Copy link
Contributor

jhrozek commented Jul 10, 2018

Thanks, this is a good start. We also want to remove the whole pysss.local interface and don't build the sss_* tools like sss_useradd and so on.

If you want to remove the usage of the local provider from tests, does it make sense to keep the code at all using the is_local_provider functions? Remember the code is not lost forever, we can always ressurect it from git history.

@jhrozek
Copy link
Contributor

jhrozek commented Jul 10, 2018

btw I'm not sold either way myself, on one hand the local provider might be handy for tests, on the other hand I haven't used it in a long time myself. So I would not be completely mad if it goes away.

gid = 0;
} else {
uid = 1234 + i;
gid = 1234 + i;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would even say we can drop the conditional and just use the else branch.

gid = 0;
} else {
uid = 1234;
gid = 1234;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would even drop the if branch and only use the else branch.

@@ -1095,6 +1105,9 @@ START_TEST(test_user_group_by_name)
* ldap provider differently with auto_private_groups.
*/
test_ctx->domain->provider = discard_const_p(char, "ldap");
if (!local_provider_is_built()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, this test might be handy. Since some functions differ in functionality with mpg enabled domain, I think we want to have a test. But I think just adding a unit test with mpg=true is simpler and more error proof than having an if-else branch based on how sssd is built.

@@ -1827,6 +1844,7 @@ START_TEST (test_sysdb_remove_nonexistent_group)
}
END_TEST

#ifdef BUILD_LOCAL_PROVIDER
Copy link
Contributor

Choose a reason for hiding this comment

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

OTOH, I think this ifdef is fine because the get_new_id function is only useful for the local provider.

@jhrozek
Copy link
Contributor

jhrozek commented Jul 10, 2018

About the sysdb tests, can you paste what issues you faced here? Or push a branch? I could see issues with not matching number of groups returned because the local provider is mpg-enabled by default, but I don't know what the issue with users could be.

@pbrezina
Copy link
Member

Thanks, this is a good start. We also want to remove the whole pysss.local interface and don't build the sss_* tools like sss_useradd and so on.

If you want to remove the usage of the local provider from tests, does it make sense to keep the code at all using the is_local_provider functions? Remember the code is not lost forever, we can always ressurect it from git history.

btw I'm not sold either way myself, on one hand the local provider might be handy for tests, on the other hand I haven't used it in a long time myself. So I would not be completely mad if it goes away.

Definitely drop all the code related to local provider. It makes the code complicated since it is a special case. It is also very easy to forget it.

If it will be needed again, we can implement a simple backend for local provider just returning EOK from the dbus handlers. But I have literally never used it for testing ever. In addition, it does not really tests anything today since it never goes to backend and requires special casing in responders.

@fidencio fidencio changed the title Do not build the local provider by default WIP: Do not build the local provider by default Jul 18, 2018
@fidencio
Copy link
Contributor Author

@jhrozek, @pbrezina,

I haven't addressed any of the comments made, yet.
I've pushed the patchset containing the most of the changes theoretically needed.

We can discuss test by test in our phone meeting Tomorrow.

@fidencio
Copy link
Contributor Author

It's been discussed on IRC a few times already and let me try to make it explicit here.
I do need some help in order to make the tests that are failing to pass. Those tests theoretically only test APIs but there seem to be some changes depending on whether they are or are not used "local" provider.

The help needed here and asked on IRC a few times before is in order to figure out the changes that have to be done.

@fidencio
Copy link
Contributor Author

fidencio commented Aug 2, 2018

I've updated the patches, @pbrezina helped me with the most part of the issues I was facing.

There are still an issue in the ldap_id_cleanup() test as the test fails when ran by the first time but passes if ran again after a minute or two.

Summing up, there's still work to be done in this PR, thus i"m adding the "Changes requested" label.

@jhrozek
Copy link
Contributor

jhrozek commented Aug 3, 2018

Do you need help with triaging the failure?

@fidencio
Copy link
Contributor Author

fidencio commented Aug 3, 2018

@jhrozek, that would be really appreciated.

What I've found so far is that when not building the local provider the ldap_id_cleanup test is bailing out because when trying to cleanup the groups the search done doesn't return any records from the cache.

I've checked that those records are present in the timestamp cache and if searched there we'd bea ble to move forward. However, the search is done in the cache itself.

So, what I'm trying to understand here is why the cache has not been updated (following the timestamp cache) when not using the local provider.

@fidencio
Copy link
Contributor Author

fidencio commented Aug 6, 2018

So, thanks to both @jhrozek and @pbrezina the tests are now passing!

I've decided to re-order/re-organize the patches and all comments made should be addressed.

The series now contain:

  • A bunch of commits changing the tests to work with the "files" provider
    • It includes a few fixes needed in order to make ldap_id_cleanup test to pass;
  • One commit making the build of the "local" provider conditional
  • One commit removing pysss.local interface.

@fidencio fidencio changed the title WIP: Do not build the local provider by default Do not build the local provider by default Aug 7, 2018
@jhrozek
Copy link
Contributor

jhrozek commented Aug 12, 2018

I wish we had more time to nuke the code completely, but not building it by default is a good start. We can remove the stuff completely in 2.1

@jhrozek
Copy link
Contributor

jhrozek commented Aug 12, 2018

I'll ack once coverity finishes

@jhrozek
Copy link
Contributor

jhrozek commented Aug 13, 2018

Coverity and CI were OK

Also start to consider the "files" provider when cleaning up the files.
This change will let us start to moving to "files" provider in our test
suite.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Apart from the obvious change from "local" to "files" and from "LOCAL"
to "FILES", we're also passing an on-the-fly created uid/gid to the
sysdb_store_user() function in order to avoid calling
sysdb_get_new_id(), which only should be used with the "local" provider.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Apart from the obvious change from "local" to "files" and from "LOCAL"
to "FILES", we're also passing a static uid/gid to the sysdb_add_user()
function in order to avoid calling sysdb_get_new_id(), which only should
be used with the "local" provider. Another change doneis to explicitly
set mpg to true as it was enabled by default when using the "local"
provider.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Apart from the obvious change from "local" to "files" and from "LOCAL"
to "FILES", we also had to change the cleanup function as this test
suite doesn't rely on test_multidom_suite_cleanup().

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Apart from the obvious change from "local" to "files" and from "LOCAL"
to "FILES", we also had to change the cleanup function as this test
suite doesn't rely on test_multidom_suite_cleanup().

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Only a simple change from "local" to "files" was required.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
When trying to get rid of the "local" provider references in
ldap_id_cleanup tests by switching to "files" provider, it's been
noticed that the linearized dn wasn't coming sanitized, which would make
the test to fail.

While I'm not sure here's the right place to have it fixed, this is the
simplest proposal I could come up with.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
The reason for specifically passing a ts_subfilter is because when using
a provider that relies on a cache and on a timestamp cache, the search
done each cache is different.

The difference in the search is that on timestamp cache we add a
(dateExpireTimestamp <= XXX), but it shouldn't be added to the cache
search.

This commit is needed in order to have the ldap_id_cleanup test running
when switching from local provider (which has no timestamp cache) to the
files provider (which exposed this issue).

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

The only changes requred were the obvious change from "local" to "files"
and from "LOCAL" to "FILES".

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Let's just replace "LOCAL_SYSDB_FILE" for NULL as This test suite
doesn't create local sysdb file.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
…ution_order_

Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Let's just replace "LOCAL_SYSDB_FILE" for NULL as This test suite
doesn't create local sysdb file.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's take advantage of the files provider and start to get rid of the
local provider references in our code.

Let's just replace "LOCAL_SYSDB_FILE" for NULL as This test suite
doesn't create local sysdb file.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
As all tests are now taking advantage of the "files" provider instead of
the "local" one, let's just remove the last reference of
LOCAL_SYSDB_FILE from our tests.

Together with the reference, let's also remove the whole if-block as
we're not relying on "local" provider anymore.

Related:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Let's "get rid" of the local provider and only build it conditionally.

The local provider is only used by our integration tests and those will
be ran in the CI enabling the local provider.

If someone, for some reason, still needs to use it,
"--enable-local-provider" has been added as a configure option and the
provider can be built using that (as done in our integration tests).

Resolves:
https://pagure.io/SSSD/sssd/issue/3304

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
"local" -> "password"

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
The pysss.local interface has been de-emphasized in favour of the files
domain. As there's no current consumer of this API, let's just remove
it.

Resolves:
https://pagure.io/SSSD/sssd/issue/3493

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
@jhrozek
Copy link
Contributor

jhrozek commented Aug 13, 2018

retest this please

1 similar comment
@jhrozek
Copy link
Contributor

jhrozek commented Aug 13, 2018

retest this please

@jhrozek
Copy link
Contributor

jhrozek commented Aug 13, 2018

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

Successfully merging this pull request may close these issues.

None yet

3 participants