#7416 Uninstalling IPA requires on being in a existent working directory
Opened a year ago by rcritten. Modified 9 months ago

Issue

If you run ipa-server-install --uninstall from a non-existent directory or you are sitting in a directory that will be removed by the uninstaller then you will see warnings and a potential failure.

I've seen this by a user sitting in the dogtag alias directory and myself in development.

# ipa-server-install --uninstall -U
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
------------------------------------
Deleted IPA server "ipa.example.com"
------------------------------------
Shutting down all IPA services
Unconfiguring ntpd
Configuring certmonger to stop tracking system certificates for KRA
Configuring certmonger to stop tracking system certificates for CA
Unconfiguring CA
Unconfiguring web server
Unconfiguring krb5kdc
Unconfiguring kadmin
Unconfiguring directory server
ipapython.install.common: ERROR    Unable to determine the current directory: [Errno 2] No such file or directory
Exception ignored in: <bound method CertDB.__del__ of <ipaserver.install.certs.CertDB object at 0x7fa50286c9b0>>
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ipaserver/install/certs.py", line 227, in __del__
    os.chdir(self.cwd)
AttributeError: 'CertDB' object has no attribute 'cwd'

Steps to Reproduce

  1. make rpms
  2. su or sudo bash (important, you need a root shell)
  3. cd dist/rpms
  4. dnf install *
  5. ipa-server-install <your favorite="" options="">
  6. suspend
  7. rm -rf dist
  8. fg
  9. ipa-server-install --uninstall -U

There are many other scenarios, perhaps simpler, to reproduce. This is just how I most often run into it.

Actual behavior

fail, missing cwd.


We should do two things:

  • get rid if os.chdir() in favor of subprocess.check_call(..., cwd=directory), also see https://pagure.io/freeipa/issue/5897
  • os.chdir(/``) in the beginning of scripts that install and uninstall components.

Metadata Update from @rcritten:
- Issue priority set to: low
- Issue set to the milestone: FreeIPA 4.7
- Issue tagged with: easyfix

a year ago

https://github.com/freeipa/freeipa/pull/1781 removes os.chdir() from certdb and the p11 helper tests. This revealed another buggy test suite.

master:

  • 807a5cb certdb: Move chdir into subprocess call
  • 1b320ac Remove os.chdir() from test_ipap11helper

Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.7.1 (was: FreeIPA 4.7)

a year ago

FreeIPA 4.7 has been released, moving to FreeIPA 4.7.1 milestone

Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.7.2 (was: FreeIPA 4.7.1)

9 months ago

FreeIPA 4.7.1 has been released, moving to FreeIPA 4.7.2 milestone

Login to comment on this ticket.

Metadata