#8630 Do not resolve user/group UID/GID in the service constructors
Closed: fixed 3 years ago by abbra. Opened 3 years ago by abbra.

Service constructors are called even when the service itself is not configured. A common pattern in FreeIPA code is to instantiate a service and check whether it is configured, then perform uninstall of the service configuration. This fails if the service constructor does depend on the artifacts only present if other (relevant to the service) packages were installed.

A common pattern is:

  svc = SVCClass(..)
  if svc.is_configured(): 
      svc.uninstall()

Most of DNS-related service classes do resolution of UID/GIDs for ODS and NAMED in their constructors which breaks uninstallation of a DNS-less FreeIPA deployment because neither 'bind' nor 'opendnssec' packages are not installed and user and group they provide are not available in the system:

  File "/usr/lib/python3.6/site-packages/ipaserver/install/server/install.py", line 1184, in uninstall
    dns.uninstall()
  File "/usr/lib/python3.6/site-packages/ipaserver/install/dns.py", line 405, in uninstall
    ods = opendnssecinstance.OpenDNSSECInstance(fstore)
  File "/usr/lib/python3.6/site-packages/ipaserver/install/opendnssecinstance.py", line 70, in __init__
    self.named_gid = constants.NAMED_GROUP.gid
  File "/usr/lib/python3.6/site-packages/ipaplatform/base/constants.py", line 96, in gid
    return self.entity.gr_gid
  File "/usr/lib/python3.6/site-packages/ipaplatform/base/constants.py", line 89, in entity
    raise ValueError(f"group '{self!s}' not found") from None

2020-12-21T18:03:50Z DEBUG The ipa-server-install command failed, exception: ValueError: group 'named' not found
2020-12-21T18:03:50Z ERROR group 'named' not found

Metadata Update from @abbra:
- Issue assigned to abbra

3 years ago

Metadata Update from @abbra:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1909876

3 years ago

master:

  • 8e16a1d opendnssecinstance: use late binding for UID/GID resolution
  • b6a6453 dnskeysyncinstance: use late binding for UID/GID resolution
  • 4c4f16f odsexporterinstance: use late binding for UID/GID resolution

ipa-4-9:

  • eb42b10 opendnssecinstance: use late binding for UID/GID resolution
  • eae9f0d dnskeysyncinstance: use late binding for UID/GID resolution
  • eca2281 odsexporterinstance: use late binding for UID/GID resolution

Metadata Update from @abbra:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

3 years ago

master:

  • 69d4800 ipatests: Test if server setup without dns uninstall properly
  • 74b4d7e ipatests: Add test_uninstall.py to nightly definitions

master:

  • f621d60 Revert "ipatests: Test if server setup without dns uninstall properly"
  • 776d575 Revert "ipatests: Add test_uninstall.py to nightly definitions"
  • 3a58480 ipatests: Test if server setup without dns uninstall properly

ipa-4-9:

  • 85674f1 ipatests: Test if server setup without dns uninstall properly

Login to comment on this ticket.

Metadata