mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix ipa-client-automount install/uninstall with new install states
Issue 8384 introduced a new installation state for the statestore to identify when client/server installation is completely finished rather than relying on has_files(). The problem is that ipa-client-automount may be called during ipa-client-install and since installation is not complete at that point the automount install was failing with "IPA client not configured". Add a new state, 'automount', to designate that automount installation is in process. If check_client_configuration() fails it checks to see if [installation] automount is True. If so it continues with the installation. This also addresses an issue where the filestore and statestore are shared between the client and automount installers but the client wasn't refreshing state after automount completed. This resulted in an incomplete state and index file of backed-up files which caused files to not be restored on uninstall and the state file to be orphaned. Fixes: https://pagure.io/freeipa/issue/9487 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
8ef3d6ce5c
commit
e4420624ff
@ -1274,7 +1274,7 @@ def create_sshd_ipa_config(options):
|
||||
logger.info('Configured %s', paths.SSHD_IPA_CONFIG)
|
||||
|
||||
|
||||
def configure_automount(options):
|
||||
def configure_automount(options, statestore):
|
||||
logger.info('\nConfiguring automount:')
|
||||
|
||||
args = [
|
||||
@ -1287,12 +1287,15 @@ def configure_automount(options):
|
||||
if not options.sssd:
|
||||
args.append('--no-sssd')
|
||||
|
||||
statestore.backup_state('installation', 'automount', True)
|
||||
try:
|
||||
result = run(args)
|
||||
except Exception as e:
|
||||
logger.error('Automount configuration failed: %s', str(e))
|
||||
else:
|
||||
logger.info('%s', result.output_log)
|
||||
finally:
|
||||
statestore.delete_state('installation', 'automount')
|
||||
|
||||
|
||||
def configure_nisdomain(options, domain, statestore):
|
||||
@ -3306,7 +3309,11 @@ def _install(options, tdict):
|
||||
configure_sshd_config(fstore, options)
|
||||
|
||||
if options.location:
|
||||
configure_automount(options)
|
||||
configure_automount(options, statestore)
|
||||
|
||||
# Reload the state as automount install may have modified it
|
||||
fstore._load()
|
||||
statestore._load()
|
||||
|
||||
if options.configure_firefox:
|
||||
configure_firefox(options, statestore, cli_domain)
|
||||
@ -3369,12 +3376,15 @@ def uninstall(options):
|
||||
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
|
||||
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
|
||||
|
||||
statestore.backup_state('installation', 'automount', True)
|
||||
try:
|
||||
run([paths.IPA_CLIENT_AUTOMOUNT, "--uninstall", "--debug"])
|
||||
except CalledProcessError as e:
|
||||
if e.returncode != CLIENT_NOT_CONFIGURED:
|
||||
logger.error(
|
||||
"Unconfigured automount client failed: %s", str(e))
|
||||
finally:
|
||||
statestore.delete_state('installation', 'automount')
|
||||
|
||||
# Reload the state as automount unconfigure may have modified it
|
||||
fstore._load()
|
||||
|
@ -340,14 +340,16 @@ def configure_nfs(fstore, statestore, options):
|
||||
|
||||
|
||||
def configure_automount():
|
||||
try:
|
||||
check_client_configuration()
|
||||
except ScriptError as e:
|
||||
print(e.msg)
|
||||
sys.exit(e.rval)
|
||||
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
|
||||
if not statestore.get_state('installation', 'automount'):
|
||||
# not called from ipa-client-install
|
||||
try:
|
||||
check_client_configuration()
|
||||
except ScriptError as e:
|
||||
print(e.msg)
|
||||
sys.exit(e.rval)
|
||||
|
||||
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
|
||||
statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
|
||||
|
||||
options, _args = parse_options()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user