From 7d0a494e9582d052d3a916a1dc8f5540a031c0d3 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 20 Jun 2017 11:37:42 -0500 Subject: [PATCH] conditional import of shlex_quote Change-Id: Ic61d680d8442d63bcf0e1c525bd27e2d5d4f1e65 Signed-off-by: Kevin Carter --- connection/ssh.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/connection/ssh.py b/connection/ssh.py index ddc2dac..178969e 100644 --- a/connection/ssh.py +++ b/connection/ssh.py @@ -25,6 +25,15 @@ SSH = imp.load_source( os.path.join(os.path.dirname(conn.__file__), 'ssh.py') ) +if not hasattr(SSH, 'shlex_quote'): + # NOTE(cloudnull): Later versions of ansible has this attribute already + # however this is not set in all versions. Because we use + # this method the attribute will set within the plugin + # if it's not found. + from ansible.compat.six.moves import shlex_quote + setattr(SSH, 'shlex_quote', shlex_quote) + + class Connection(SSH.Connection): """Transport options for LXC containers.