From 0d1f8b53b821f35fae3c95a5f6117e0553f8f58d Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Wed, 7 Feb 2024 14:39:34 +0100
Subject: [PATCH] ipaclient_setup_automount: Only return changed if there was a
 change

The returned changed state was always True. changed is now only True if
automount_location is set and configure_automount was called.
---
 roles/ipaclient/library/ipaclient_setup_automount.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/roles/ipaclient/library/ipaclient_setup_automount.py b/roles/ipaclient/library/ipaclient_setup_automount.py
index 1c5cf6db..3b2671af 100644
--- a/roles/ipaclient/library/ipaclient_setup_automount.py
+++ b/roles/ipaclient/library/ipaclient_setup_automount.py
@@ -95,7 +95,9 @@ def main():
     options.automount_location = module.params.get('automount_location')
     options.location = options.automount_location
 
+    changed = False
     if options.automount_location:
+        changed = True
         argspec = getargspec(configure_automount)
         if len(argspec.args) > 1:
             fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
@@ -109,7 +111,7 @@ def main():
         else:
             configure_automount(options)
 
-    module.exit_json(changed=True)
+    module.exit_json(changed=changed)
 
 
 if __name__ == '__main__':
-- 
GitLab