Bug 1800564

Summary: `sssd.api.conf` and `sssd.api.d` should belong to `python-sssdconfig` package
Product: Red Hat Enterprise Linux 7 Reporter: Florence Blanc-Renaud <frenaud>
Component: sssdAssignee: Alexey Tikhonov <atikhono>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.8CC: atikhono, grajaiya, jhrozek, lslebodn, mniranja, mzidek, pbrezina, sgoveas, thalman, tscherf
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: sssd-1.16.5-4.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:50:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Florence Blanc-Renaud 2020-02-07 12:35:02 UTC
Description of problem:
python-sssd package should have a weak dependency on sssd-config because the call to SSSDConfig() requires the file /usr/share/sssd/sssd.conf.api to be present, and this file is provided by sssd-common.

Version-Release number of selected component (if applicable):
sssd-1.16.4-35.el7.x86_64

How reproducible:
always

Steps to Reproduce:

freeipa tests are using SSSDConfig() python API to  modify sssd.conf from another node.
On host A (=the test controller), only python-sssd package is installed. On host B (=freeipa master), sssd is configured (with python-sssd, sssd-common, sssd-client).
The host A is copying sssd.conf from host B, then locally uses SSSDConfig() to modify the conf and later copies the modified sssd.conf file to host B.

The following error happens when host A calls SSSDConfig():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pytest_ipa/integration/tasks.py:741: in modify_sssd_conf
    sssd_config = SSSDConfig()
../SSSDConfig/__init__.py:1424: in __init__
    self.schema = SSSDConfigSchema(schemafile, schemaplugindir)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SSSDConfig.SSSDConfigSchema object at 0x7f3fc57a9ed0>
schemafile = '/usr/share/sssd/sssd.api.conf'
schemaplugindir = '/usr/share/sssd/sssd.api.d'

    def __init__(self, schemafile, schemaplugindir):
        SSSDChangeConf.__init__(self)
        #TODO: get these from a global setting
        if not schemafile:
            schemafile = '/usr/share/sssd/sssd.api.conf'
        if not schemaplugindir:
            schemaplugindir = '/usr/share/sssd/sssd.api.d'
    
        try:
            # Read the primary config file
>           with open(schemafile, 'r') as fd:
E           IOError: [Errno 2] No such file or directory: '/usr/share/sssd/sssd.api.conf'

schemafile = '/usr/share/sssd/sssd.api.conf'
schemaplugindir = '/usr/share/sssd/sssd.api.d'
self       = <SSSDConfig.SSSDConfigSchema object at 0x7f3fc57a9ed0>

../SSSDConfig/__init__.py:508: IOError


Actual results:
IOError when calling SSSDConfig() if the package sssd-common is not installed.

Expected results:
No IOError.

Comment 2 Lukas Slebodnik 2020-02-07 13:46:30 UTC
rhel7 does not work well with weak dependencies and adding required dependency is wrong.

Comment 3 Lukas Slebodnik 2020-02-07 13:51:44 UTC
> On host A (=the test controller), only python-sssd package is installed. On host B (=freeipa master)

Florence that approach is fragile.

You might have different version of sssd installed on host A and host B.
An schema for sssd on host A might be different than on host B.

e.g.
host A (controller is rhel8) and host B (is rhel6)

Schema validation might pass on new version but it might fail on old version.
So the best would be:
* to copy schema files together with sssd.con from (host B) to controller.
* do not pass default schema on controller (if it is not possible than it should be)
* do magic
* copy sssd.conf from controller to host B

Comment 5 Alexey Tikhonov 2020-04-29 12:56:32 UTC
(In reply to Florence Blanc-Renaud from comment #0)
> Description of problem:
> python-sssd package should have a weak dependency on sssd-config because the


I'm a little bit confused:
 - "python-sssd" package doesn't exist (there is "python-sss")
 - title says "on sssd-common", but description says "on sssd-config" (and "sssd-config" doesn't exist, there is "python-sssdconfig")
 - to be able to call `SSSDConfig()` in python code one needs "python-sssdconfig" package, not "python-sss"

(Sorry for all those nitpicks, this is partially to make things clear for myself)


1) Do I understand correctly that the request is to add "sssd-common" as a dependency of "python-sssdconfig"?
2) Do I understand correctly the same applies to rhel8?

Comment 6 Alexey Tikhonov 2020-04-29 15:23:24 UTC
I think it is better to move 'sssd.api.*' to "python-sssdconfig" instead of making dependency.

Upstream PR: https://github.com/SSSD/sssd/pull/1039

Comment 8 Florence Blanc-Renaud 2020-05-04 12:38:06 UTC
Hi Alexey,

you are right, the package that is providing SSSDConfig is python-sssdconfig and not python-sssd. Your proposal in #c6 looks good to me.

Comment 9 Alexey Tikhonov 2020-05-07 13:00:33 UTC
  * master
        5379fdd - SPEC: 'sssd.api.*' should belong python-sssdconfig
  * sssd-1-16
        0ecc498 - SPEC: 'sssd.api.*' should belong python-sssdconfig

Comment 14 Niranjan Mallapadi Raghavender 2020-06-10 08:59:18 UTC
Version:
sssd-common-pac-1.16.4-21.el7_7.1.x86_64
sssd-krb5-1.16.4-21.el7_7.1.x86_64
sssd-kcm-1.16.4-21.el7_7.1.x86_64
python-sssdconfig-1.16.4-21.el7_7.1.noarch
sssd-client-1.16.4-21.el7_7.1.x86_64
sssd-krb5-common-1.16.4-21.el7_7.1.x86_64
sssd-ad-1.16.4-21.el7_7.1.x86_64
sssd-ldap-1.16.4-21.el7_7.1.x86_64
sssd-proxy-1.16.4-21.el7_7.1.x86_64
sssd-dbus-1.16.4-21.el7_7.1.x86_64
sssd-1.16.4-21.el7_7.1.x86_64
sssd-common-1.16.4-21.el7_7.1.x86_64
sssd-ipa-1.16.4-21.el7_7.1.x86_64
sssd-tools-1.16.4-21.el7_7.1.x86_64
sssd-winbind-idmap-1.16.4-21.el7_7.1.x86_64


[root@cloud-qe-09 ~]# rpm -qf /usr/share/sssd/sssd.api.conf
sssd-common-1.16.4-21.el7_7.1.x86_64


On fixed version:

[root@auto-hv-02-guest02 ~]# rpm -qf /usr/share/sssd/sssd.api.conf
python-sssdconfig-1.16.5-8.el7.noarch

Removes sssd-common package 

[root@auto-hv-02-guest02 ~]# rpm -qa | grep sssd
python-sssdconfig-1.16.5-8.el7.noarch
sssd-client-1.16.5-8.el7.x86_64


[root@auto-hv-02-guest02 ~]# cat a.py
from SSSDConfig import SSSDConfig
sssd_config = SSSDConfig()
print(type(sssd_config))


[root@auto-hv-02-guest02 ~]# python a.py 
<class 'SSSDConfig.SSSDConfig'>

Comment 16 errata-xmlrpc 2020-09-29 19:50:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sssd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:3904