From abfe36c62f2e58d6660dce6559a8c38ea37f6b1c Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Wed, 7 Sep 2022 11:05:24 +0900 Subject: [PATCH] Fix to follow pylint check in ansible-test-sanity-docker-devel Signed-off-by: Hideki Saito --- changelogs/fragments/386_follow_ci_testing_rules.yml | 3 +++ plugins/modules/authorized_key.py | 2 ++ plugins/modules/mount.py | 2 +- .../targets/authorized_key/tasks/setup_steps.yml | 9 +++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/386_follow_ci_testing_rules.yml diff --git a/changelogs/fragments/386_follow_ci_testing_rules.yml b/changelogs/fragments/386_follow_ci_testing_rules.yml new file mode 100644 index 0000000..f59e82a --- /dev/null +++ b/changelogs/fragments/386_follow_ci_testing_rules.yml @@ -0,0 +1,3 @@ +--- +trivial: + - CI - following the new CI testing rule ansible-test-sanity-docker-devel. diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index e11b416..5e37c28 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -347,6 +347,8 @@ def keyfile(module, user, write=False, path=None, manage_dir=True, follow=False) basedir = os.path.dirname(keysfile) if not os.path.exists(basedir): os.makedirs(basedir) + + f = None try: f = open(keysfile, "w") # touches file so we can set ownership and perms finally: diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 2021464..58b49bc 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -226,7 +226,7 @@ def _escape_fstab(v): if isinstance(v, int): return v else: - return( + return ( v. replace('\\', '\\134'). replace(' ', '\\040'). diff --git a/tests/integration/targets/authorized_key/tasks/setup_steps.yml b/tests/integration/targets/authorized_key/tasks/setup_steps.yml index a3c21dc..2144b7a 100644 --- a/tests/integration/targets/authorized_key/tasks/setup_steps.yml +++ b/tests/integration/targets/authorized_key/tasks/setup_steps.yml @@ -1,5 +1,14 @@ # ------------------------------------------------------------- # Setup steps +- name: Clean up the working directory and files + file: + path: '{{ output_dir }}' + state: absent + +- name: Create the working directory + file: + path: '{{ output_dir }}' + state: directory - name: copy an existing file in place with comments copy: