From 7cfdc2ce8cf6501e8cb4dffeb4f0a84698949bca Mon Sep 17 00:00:00 2001 From: Pan Luo Date: Tue, 28 Sep 2021 21:51:18 -0700 Subject: [PATCH] Copy the permissions along with file for jboss module (#3426) * Copy the permissions along with file for jboss module Issue: The deployment file is copied with file content only. The file permission is set to 440 and belongs to root user. When the JBossI(Wildfly) server is running under non root account, it can't read the deployment file. With is fix, the correct permission can be set from previous task for JBoss server to pickup the deployment file. * Update changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml Co-authored-by: Ajpantuso Co-authored-by: Ajpantuso --- ...26-copy-permissions-along-with-file-for-jboss-module.yml | 6 ++++++ plugins/modules/web_infrastructure/jboss.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml diff --git a/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml b/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml new file mode 100644 index 0000000000..7685cce02b --- /dev/null +++ b/changelogs/fragments/3426-copy-permissions-along-with-file-for-jboss-module.yml @@ -0,0 +1,6 @@ +bugfixes: + - jboss - fix the deployment file permission issue when Jboss server is running + under non-root user. The deployment file is copied with file content only. The + file permission is set to ``440`` and belongs to root user. When the + JBoss ``WildFly`` server is running under non-root user, it is unable to read + the deployment file (https://github.com/ansible-collections/community.general/pull/3426). diff --git a/plugins/modules/web_infrastructure/jboss.py b/plugins/modules/web_infrastructure/jboss.py index 4c077a1ddb..5512e10ee4 100644 --- a/plugins/modules/web_infrastructure/jboss.py +++ b/plugins/modules/web_infrastructure/jboss.py @@ -142,7 +142,7 @@ def main(): # Clean up old failed deployment os.remove(os.path.join(deploy_path, "%s.failed" % deployment)) - shutil.copyfile(src, os.path.join(deploy_path, deployment)) + module.preserved_copy(src, os.path.join(deploy_path, deployment)) while not deployed: deployed = is_deployed(deploy_path, deployment) if is_failed(deploy_path, deployment): @@ -153,7 +153,7 @@ def main(): if state == 'present' and deployed: if module.sha1(src) != module.sha1(os.path.join(deploy_path, deployment)): os.remove(os.path.join(deploy_path, "%s.deployed" % deployment)) - shutil.copyfile(src, os.path.join(deploy_path, deployment)) + module.preserved_copy(src, os.path.join(deploy_path, deployment)) deployed = False while not deployed: deployed = is_deployed(deploy_path, deployment)