We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error: unknown command "drain" for "oc" in « Drain Node for Kubelet upgrade » action
« [Drain Node for Kubelet upgrade](https://github.com/openshift/openshift-ansible/blob/release-3.6/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml#L27) » action execute: `oadm drain ...` but this command don't exists:

```
# oadm  drain
Error: unknown command "drain" for "oc"
Run 'oc --help' for usage.
```

with this version:

```
# oc version
oc v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO
```

To fix it, I need to add `adm` like this `oadm adm drain ...`

```
diff --git a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
index c93a5d8..a21fb7f 100644
--- a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
+++ b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml
@@ -26,7 +26,7 @@

   - name: Drain Node for Kubelet upgrade
     command: >
-      {{ hostvars[groups.oo_first_master.0].openshift.common.admin_binary }} drain {{ openshift.node.nodename | lower }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig --force --delete-local-data --ignore-daemonsets
+      {{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} adm drain {{ openshift.node.nodename | lower }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig --force --delete-local-data --ignore-daemonsets
     delegate_to: "{{ groups.oo_first_master.0 }}"
     register: l_upgrade_nodes_drain_result
     until: not l_upgrade_nodes_drain_result | failed
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `roles/openshift_cli/library/openshift_container_binary_sync.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # pylint: disable=missing-docstring,invalid-name
4 
5 import random
6 import tempfile
7 import shutil
8 import os.path
9 
10 # pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import
11 from ansible.module_utils.basic import *  # noqa: F403
12 
13 
14 DOCUMENTATION = '''
15 ---
16 module: openshift_container_binary_sync
17 short_description: Copies OpenShift binaries out of the given image tag to host system.
18 '''
19 
20 
21 class BinarySyncError(Exception):
22     def __init__(self, msg):
23         super(BinarySyncError, self).__init__(msg)
24         self.msg = msg
25 
26 
27 # pylint: disable=too-few-public-methods,too-many-instance-attributes
28 class BinarySyncer(object):
29     """
30     Syncs the openshift, oc, oadm, and kubectl binaries/symlinks out of
31     a container onto the host system.
32     """
33 
34     def __init__(self, module, image, tag, backend):
35         self.module = module
36         self.changed = False
37         self.output = []
38         self.bin_dir = '/usr/local/bin'
39         self.image = image
40         self.tag = tag
41         self.backend = backend
42         self.temp_dir = None  # TBD
43 
44     def sync(self):
45         if self.backend == 'atomic':
46             return self._sync_atomic()
47 
48         return self._sync_docker()
49 
50     def _sync_atomic(self):
51         self.temp_dir = tempfile.mkdtemp()
52         temp_dir_mount = tempfile.mkdtemp()
53         try:
54             image_spec = '%s:%s' % (self.image, self.tag)
55             rc, stdout, stderr = self.module.run_command(['atomic', 'mount',
56                                                           '--storage', "ostree",
57                                                           image_spec, temp_dir_mount])
58             if rc:
59                 raise BinarySyncError("Error mounting image. stdout=%s, stderr=%s" %
60                                       (stdout, stderr))
61             for i in ["openshift", "oc"]:
62                 src_file = os.path.join(temp_dir_mount, "usr/bin", i)
63                 shutil.copy(src_file, self.temp_dir)
64 
65             self._sync_binaries()
66         finally:
67             self.module.run_command(['atomic', 'umount', temp_dir_mount])
68             shutil.rmtree(temp_dir_mount)
69             shutil.rmtree(self.temp_dir)
70 
71     def _sync_docker(self):
72         container_name = "openshift-cli-%s" % random.randint(1, 100000)
73         rc, stdout, stderr = self.module.run_command(['docker', 'create', '--name',
74                                                       container_name, '%s:%s' % (self.image, self.tag)])
75         if rc:
76             raise BinarySyncError("Error creating temporary docker container. stdout=%s, stderr=%s" %
77                                   (stdout, stderr))
78         self.output.append(stdout)
79         try:
80             self.temp_dir = tempfile.mkdtemp()
81             self.output.append("Using temp dir: %s" % self.temp_dir)
82 
83             rc, stdout, stderr = self.module.run_command(['docker', 'cp', "%s:/usr/bin/openshift" % container_name,
84                                                           self.temp_dir])
85             if rc:
86                 raise BinarySyncError("Error copying file from docker container: stdout=%s, stderr=%s" %
87                                       (stdout, stderr))
88 
89             rc, stdout, stderr = self.module.run_command(['docker', 'cp', "%s:/usr/bin/oc" % container_name,
90                                                           self.temp_dir])
91             if rc:
92                 raise BinarySyncError("Error copying file from docker container: stdout=%s, stderr=%s" %
93                                       (stdout, stderr))
94 
95             self._sync_binaries()
96         finally:
97             shutil.rmtree(self.temp_dir)
98             self.module.run_command(['docker', 'rm', container_name])
99 
100     def _sync_binaries(self):
101         self._sync_binary('openshift')
102 
103         # In older versions, oc was a symlink to openshift:
104         if os.path.islink(os.path.join(self.temp_dir, 'oc')):
105             self._sync_symlink('oc', 'openshift')
106         else:
107             self._sync_binary('oc')
108 
109         # Ensure correct symlinks created:
110         self._sync_symlink('kubectl', 'openshift')
111         self._sync_symlink('oadm', 'openshift')
112 
113     def _sync_symlink(self, binary_name, link_to):
114         """ Ensure the given binary name exists and links to the expected binary. """
115 
116         # The symlink we are creating:
117         link_path = os.path.join(self.bin_dir, binary_name)
118 
119         # The expected file we should be linking to:
120         link_dest = os.path.join(self.bin_dir, link_to)
121 
122         if not os.path.exists(link_path) or \
123                 not os.path.islink(link_path) or \
124                 os.path.realpath(link_path) != os.path.realpath(link_dest):
125             if os.path.exists(link_path):
126                 os.remove(link_path)
127             os.symlink(link_to, os.path.join(self.bin_dir, binary_name))
128             self.output.append("Symlinked %s to %s." % (link_path, link_dest))
129             self.changed = True
130 
131     def _sync_binary(self, binary_name):
132         src_path = os.path.join(self.temp_dir, binary_name)
133         dest_path = os.path.join(self.bin_dir, binary_name)
134         incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]
135         if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:
136             shutil.move(src_path, dest_path)
137             self.output.append("Moved %s to %s." % (src_path, dest_path))
138             self.changed = True
139 
140 
141 def main():
142     module = AnsibleModule(  # noqa: F405
143         argument_spec=dict(
144             image=dict(required=True),
145             tag=dict(required=True),
146             backend=dict(required=True),
147         ),
148         supports_check_mode=True
149     )
150 
151     image = module.params['image']
152     tag = module.params['tag']
153     backend = module.params['backend']
154 
155     if backend not in ["docker", "atomic"]:
156         module.fail_json(msg="unknown backend")
157 
158     binary_syncer = BinarySyncer(module, image, tag, backend)
159 
160     try:
161         binary_syncer.sync()
162     except BinarySyncError as ex:
163         module.fail_json(msg=ex.msg)
164 
165     return module.exit_json(changed=binary_syncer.changed,
166                             output=binary_syncer.output)
167 
168 
169 if __name__ == '__main__':
170     main()
171
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/roles/openshift_cli/library/openshift_container_binary_sync.py b/roles/openshift_cli/library/openshift_container_binary_sync.py
--- a/roles/openshift_cli/library/openshift_container_binary_sync.py
+++ b/roles/openshift_cli/library/openshift_container_binary_sync.py
@@ -133,6 +133,11 @@
         dest_path = os.path.join(self.bin_dir, binary_name)
         incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]
         if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:
+
+            # See: https://github.com/openshift/openshift-ansible/issues/4965
+            if os.path.islink(dest_path):
+                os.unlink(dest_path)
+                self.output.append('Removed old symlink {} before copying binary.'.format(dest_path))
             shutil.move(src_path, dest_path)
             self.output.append("Moved %s to %s." % (src_path, dest_path))
             self.changed = True

{"golden_diff": "diff --git a/roles/openshift_cli/library/openshift_container_binary_sync.py b/roles/openshift_cli/library/openshift_container_binary_sync.py\n--- a/roles/openshift_cli/library/openshift_container_binary_sync.py\n+++ b/roles/openshift_cli/library/openshift_container_binary_sync.py\n@@ -133,6 +133,11 @@\n         dest_path = os.path.join(self.bin_dir, binary_name)\n         incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]\n         if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:\n+\n+            # See: https://github.com/openshift/openshift-ansible/issues/4965\n+            if os.path.islink(dest_path):\n+                os.unlink(dest_path)\n+                self.output.append('Removed old symlink {} before copying binary.'.format(dest_path))\n             shutil.move(src_path, dest_path)\n             self.output.append(\"Moved %s to %s.\" % (src_path, dest_path))\n             self.changed = True\n", "issue": "Error: unknown command \"drain\" for \"oc\" in \u00ab Drain Node for Kubelet upgrade \u00bb action\n\u00ab [Drain Node for Kubelet upgrade](https://github.com/openshift/openshift-ansible/blob/release-3.6/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml#L27) \u00bb action execute: `oadm drain ...` but this command don't exists:\r\n\r\n```\r\n# oadm  drain\r\nError: unknown command \"drain\" for \"oc\"\r\nRun 'oc --help' for usage.\r\n```\r\n\r\nwith this version:\r\n\r\n```\r\n# oc version\r\noc v3.6.0+c4dd4cf\r\nkubernetes v1.6.1+5115d708d7\r\nfeatures: Basic-Auth GSSAPI Kerberos SPNEGO\r\n```\r\n\r\nTo fix it, I need to add `adm` like this `oadm adm drain ...`\r\n\r\n```\r\ndiff --git a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml\r\nindex c93a5d8..a21fb7f 100644\r\n--- a/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml\r\n+++ b/playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml\r\n@@ -26,7 +26,7 @@\r\n\r\n   - name: Drain Node for Kubelet upgrade\r\n     command: >\r\n-      {{ hostvars[groups.oo_first_master.0].openshift.common.admin_binary }} drain {{ openshift.node.nodename | lower }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig --force --delete-local-data --ignore-daemonsets\r\n+      {{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} adm drain {{ openshift.node.nodename | lower }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig --force --delete-local-data --ignore-daemonsets\r\n     delegate_to: \"{{ groups.oo_first_master.0 }}\"\r\n     register: l_upgrade_nodes_drain_result\r\n     until: not l_upgrade_nodes_drain_result | failed\r\n```\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# pylint: disable=missing-docstring,invalid-name\n\nimport random\nimport tempfile\nimport shutil\nimport os.path\n\n# pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import\nfrom ansible.module_utils.basic import *  # noqa: F403\n\n\nDOCUMENTATION = '''\n---\nmodule: openshift_container_binary_sync\nshort_description: Copies OpenShift binaries out of the given image tag to host system.\n'''\n\n\nclass BinarySyncError(Exception):\n    def __init__(self, msg):\n        super(BinarySyncError, self).__init__(msg)\n        self.msg = msg\n\n\n# pylint: disable=too-few-public-methods,too-many-instance-attributes\nclass BinarySyncer(object):\n    \"\"\"\n    Syncs the openshift, oc, oadm, and kubectl binaries/symlinks out of\n    a container onto the host system.\n    \"\"\"\n\n    def __init__(self, module, image, tag, backend):\n        self.module = module\n        self.changed = False\n        self.output = []\n        self.bin_dir = '/usr/local/bin'\n        self.image = image\n        self.tag = tag\n        self.backend = backend\n        self.temp_dir = None  # TBD\n\n    def sync(self):\n        if self.backend == 'atomic':\n            return self._sync_atomic()\n\n        return self._sync_docker()\n\n    def _sync_atomic(self):\n        self.temp_dir = tempfile.mkdtemp()\n        temp_dir_mount = tempfile.mkdtemp()\n        try:\n            image_spec = '%s:%s' % (self.image, self.tag)\n            rc, stdout, stderr = self.module.run_command(['atomic', 'mount',\n                                                          '--storage', \"ostree\",\n                                                          image_spec, temp_dir_mount])\n            if rc:\n                raise BinarySyncError(\"Error mounting image. stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n            for i in [\"openshift\", \"oc\"]:\n                src_file = os.path.join(temp_dir_mount, \"usr/bin\", i)\n                shutil.copy(src_file, self.temp_dir)\n\n            self._sync_binaries()\n        finally:\n            self.module.run_command(['atomic', 'umount', temp_dir_mount])\n            shutil.rmtree(temp_dir_mount)\n            shutil.rmtree(self.temp_dir)\n\n    def _sync_docker(self):\n        container_name = \"openshift-cli-%s\" % random.randint(1, 100000)\n        rc, stdout, stderr = self.module.run_command(['docker', 'create', '--name',\n                                                      container_name, '%s:%s' % (self.image, self.tag)])\n        if rc:\n            raise BinarySyncError(\"Error creating temporary docker container. stdout=%s, stderr=%s\" %\n                                  (stdout, stderr))\n        self.output.append(stdout)\n        try:\n            self.temp_dir = tempfile.mkdtemp()\n            self.output.append(\"Using temp dir: %s\" % self.temp_dir)\n\n            rc, stdout, stderr = self.module.run_command(['docker', 'cp', \"%s:/usr/bin/openshift\" % container_name,\n                                                          self.temp_dir])\n            if rc:\n                raise BinarySyncError(\"Error copying file from docker container: stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n\n            rc, stdout, stderr = self.module.run_command(['docker', 'cp', \"%s:/usr/bin/oc\" % container_name,\n                                                          self.temp_dir])\n            if rc:\n                raise BinarySyncError(\"Error copying file from docker container: stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n\n            self._sync_binaries()\n        finally:\n            shutil.rmtree(self.temp_dir)\n            self.module.run_command(['docker', 'rm', container_name])\n\n    def _sync_binaries(self):\n        self._sync_binary('openshift')\n\n        # In older versions, oc was a symlink to openshift:\n        if os.path.islink(os.path.join(self.temp_dir, 'oc')):\n            self._sync_symlink('oc', 'openshift')\n        else:\n            self._sync_binary('oc')\n\n        # Ensure correct symlinks created:\n        self._sync_symlink('kubectl', 'openshift')\n        self._sync_symlink('oadm', 'openshift')\n\n    def _sync_symlink(self, binary_name, link_to):\n        \"\"\" Ensure the given binary name exists and links to the expected binary. \"\"\"\n\n        # The symlink we are creating:\n        link_path = os.path.join(self.bin_dir, binary_name)\n\n        # The expected file we should be linking to:\n        link_dest = os.path.join(self.bin_dir, link_to)\n\n        if not os.path.exists(link_path) or \\\n                not os.path.islink(link_path) or \\\n                os.path.realpath(link_path) != os.path.realpath(link_dest):\n            if os.path.exists(link_path):\n                os.remove(link_path)\n            os.symlink(link_to, os.path.join(self.bin_dir, binary_name))\n            self.output.append(\"Symlinked %s to %s.\" % (link_path, link_dest))\n            self.changed = True\n\n    def _sync_binary(self, binary_name):\n        src_path = os.path.join(self.temp_dir, binary_name)\n        dest_path = os.path.join(self.bin_dir, binary_name)\n        incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]\n        if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:\n            shutil.move(src_path, dest_path)\n            self.output.append(\"Moved %s to %s.\" % (src_path, dest_path))\n            self.changed = True\n\n\ndef main():\n    module = AnsibleModule(  # noqa: F405\n        argument_spec=dict(\n            image=dict(required=True),\n            tag=dict(required=True),\n            backend=dict(required=True),\n        ),\n        supports_check_mode=True\n    )\n\n    image = module.params['image']\n    tag = module.params['tag']\n    backend = module.params['backend']\n\n    if backend not in [\"docker\", \"atomic\"]:\n        module.fail_json(msg=\"unknown backend\")\n\n    binary_syncer = BinarySyncer(module, image, tag, backend)\n\n    try:\n        binary_syncer.sync()\n    except BinarySyncError as ex:\n        module.fail_json(msg=ex.msg)\n\n    return module.exit_json(changed=binary_syncer.changed,\n                            output=binary_syncer.output)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "roles/openshift_cli/library/openshift_container_binary_sync.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# pylint: disable=missing-docstring,invalid-name\n\nimport random\nimport tempfile\nimport shutil\nimport os.path\n\n# pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import\nfrom ansible.module_utils.basic import *  # noqa: F403\n\n\nDOCUMENTATION = '''\n---\nmodule: openshift_container_binary_sync\nshort_description: Copies OpenShift binaries out of the given image tag to host system.\n'''\n\n\nclass BinarySyncError(Exception):\n    def __init__(self, msg):\n        super(BinarySyncError, self).__init__(msg)\n        self.msg = msg\n\n\n# pylint: disable=too-few-public-methods,too-many-instance-attributes\nclass BinarySyncer(object):\n    \"\"\"\n    Syncs the openshift, oc, oadm, and kubectl binaries/symlinks out of\n    a container onto the host system.\n    \"\"\"\n\n    def __init__(self, module, image, tag, backend):\n        self.module = module\n        self.changed = False\n        self.output = []\n        self.bin_dir = '/usr/local/bin'\n        self.image = image\n        self.tag = tag\n        self.backend = backend\n        self.temp_dir = None  # TBD\n\n    def sync(self):\n        if self.backend == 'atomic':\n            return self._sync_atomic()\n\n        return self._sync_docker()\n\n    def _sync_atomic(self):\n        self.temp_dir = tempfile.mkdtemp()\n        temp_dir_mount = tempfile.mkdtemp()\n        try:\n            image_spec = '%s:%s' % (self.image, self.tag)\n            rc, stdout, stderr = self.module.run_command(['atomic', 'mount',\n                                                          '--storage', \"ostree\",\n                                                          image_spec, temp_dir_mount])\n            if rc:\n                raise BinarySyncError(\"Error mounting image. stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n            for i in [\"openshift\", \"oc\"]:\n                src_file = os.path.join(temp_dir_mount, \"usr/bin\", i)\n                shutil.copy(src_file, self.temp_dir)\n\n            self._sync_binaries()\n        finally:\n            self.module.run_command(['atomic', 'umount', temp_dir_mount])\n            shutil.rmtree(temp_dir_mount)\n            shutil.rmtree(self.temp_dir)\n\n    def _sync_docker(self):\n        container_name = \"openshift-cli-%s\" % random.randint(1, 100000)\n        rc, stdout, stderr = self.module.run_command(['docker', 'create', '--name',\n                                                      container_name, '%s:%s' % (self.image, self.tag)])\n        if rc:\n            raise BinarySyncError(\"Error creating temporary docker container. stdout=%s, stderr=%s\" %\n                                  (stdout, stderr))\n        self.output.append(stdout)\n        try:\n            self.temp_dir = tempfile.mkdtemp()\n            self.output.append(\"Using temp dir: %s\" % self.temp_dir)\n\n            rc, stdout, stderr = self.module.run_command(['docker', 'cp', \"%s:/usr/bin/openshift\" % container_name,\n                                                          self.temp_dir])\n            if rc:\n                raise BinarySyncError(\"Error copying file from docker container: stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n\n            rc, stdout, stderr = self.module.run_command(['docker', 'cp', \"%s:/usr/bin/oc\" % container_name,\n                                                          self.temp_dir])\n            if rc:\n                raise BinarySyncError(\"Error copying file from docker container: stdout=%s, stderr=%s\" %\n                                      (stdout, stderr))\n\n            self._sync_binaries()\n        finally:\n            shutil.rmtree(self.temp_dir)\n            self.module.run_command(['docker', 'rm', container_name])\n\n    def _sync_binaries(self):\n        self._sync_binary('openshift')\n\n        # In older versions, oc was a symlink to openshift:\n        if os.path.islink(os.path.join(self.temp_dir, 'oc')):\n            self._sync_symlink('oc', 'openshift')\n        else:\n            self._sync_binary('oc')\n\n        # Ensure correct symlinks created:\n        self._sync_symlink('kubectl', 'openshift')\n        self._sync_symlink('oadm', 'openshift')\n\n    def _sync_symlink(self, binary_name, link_to):\n        \"\"\" Ensure the given binary name exists and links to the expected binary. \"\"\"\n\n        # The symlink we are creating:\n        link_path = os.path.join(self.bin_dir, binary_name)\n\n        # The expected file we should be linking to:\n        link_dest = os.path.join(self.bin_dir, link_to)\n\n        if not os.path.exists(link_path) or \\\n                not os.path.islink(link_path) or \\\n                os.path.realpath(link_path) != os.path.realpath(link_dest):\n            if os.path.exists(link_path):\n                os.remove(link_path)\n            os.symlink(link_to, os.path.join(self.bin_dir, binary_name))\n            self.output.append(\"Symlinked %s to %s.\" % (link_path, link_dest))\n            self.changed = True\n\n    def _sync_binary(self, binary_name):\n        src_path = os.path.join(self.temp_dir, binary_name)\n        dest_path = os.path.join(self.bin_dir, binary_name)\n        incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]\n        if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:\n\n            # See: https://github.com/openshift/openshift-ansible/issues/4965\n            if os.path.islink(dest_path):\n                os.unlink(dest_path)\n                self.output.append('Removed old symlink {} before copying binary.'.format(dest_path))\n            shutil.move(src_path, dest_path)\n            self.output.append(\"Moved %s to %s.\" % (src_path, dest_path))\n            self.changed = True\n\n\ndef main():\n    module = AnsibleModule(  # noqa: F405\n        argument_spec=dict(\n            image=dict(required=True),\n            tag=dict(required=True),\n            backend=dict(required=True),\n        ),\n        supports_check_mode=True\n    )\n\n    image = module.params['image']\n    tag = module.params['tag']\n    backend = module.params['backend']\n\n    if backend not in [\"docker\", \"atomic\"]:\n        module.fail_json(msg=\"unknown backend\")\n\n    binary_syncer = BinarySyncer(module, image, tag, backend)\n\n    try:\n        binary_syncer.sync()\n    except BinarySyncError as ex:\n        module.fail_json(msg=ex.msg)\n\n    return module.exit_json(changed=binary_syncer.changed,\n                            output=binary_syncer.output)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "roles/openshift_cli/library/openshift_container_binary_sync.py"}]}