We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
glance images uploaded via os_image with is_public: true are not public
I have the following in a playbook:

```
- name: uploading centos atomic image to glance
  os_image:
    name: centos-7-atomic
    is_public: yes
    filename: images/centos-7-atomic.qcow2
```

The resulting image is not public:

```
+------------------------------+------------------+
| Property                     | Value            |
+------------------------------+------------------+
| name                         | centos-7-atomic  |
| visibility                   | private          |
+------------------------------+------------------+
```

Whereas if I upload an image from the command line:

```
glance image-create --file images/centos-7-atomic.qcow2 \
  --name larstest --visibility public \
  --disk-format qcow2 --container-format bare
```

The resulting image is publicly visible:

```
+------------------+-------------+
| Property         | Value       |
+------------------+-------------+
| name             | larstest    |
| visibility       | public      |
+------------------+-------------+
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cloud/openstack/os_image.py`
Content:
```
1 #!/usr/bin/python
2 
3 # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
4 # Copyright (c) 2013, Benno Joy <benno@ansible.com>
5 #
6 # This module is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This software is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this software.  If not, see <http://www.gnu.org/licenses/>.
18 
19 #TODO(mordred): we need to support "location"(v1) and "locations"(v2)
20 try:
21     import shade
22     HAS_SHADE = True
23 except ImportError:
24     HAS_SHADE = False
25 
26 
27 DOCUMENTATION = '''
28 ---
29 module: os_image
30 short_description: Add/Delete images from OpenStack Cloud
31 extends_documentation_fragment: openstack
32 version_added: "2.0"
33 author: "Monty Taylor (@emonty)"
34 description:
35    - Add or Remove images from the OpenStack Image Repository
36 options:
37    name:
38      description:
39         - Name that has to be given to the image
40      required: true
41      default: None
42    disk_format:
43      description:
44         - The format of the disk that is getting uploaded
45      required: false
46      default: qcow2
47    container_format:
48      description:
49         - The format of the container
50      required: false
51      default: bare
52    owner:
53      description:
54         - The owner of the image
55      required: false
56      default: None
57    min_disk:
58      description:
59         - The minimum disk space required to deploy this image
60      required: false
61      default: None
62    min_ram:
63      description:
64         - The minimum ram required to deploy this image
65      required: false
66      default: None
67    is_public:
68      description:
69         - Whether the image can be accessed publicly. Note that publicizing an image requires admin role by default.
70      required: false
71      default: 'yes'
72    filename:
73      description:
74         - The path to the file which has to be uploaded
75      required: false
76      default: None
77    ramdisk:
78      description:
79         - The name of an existing ramdisk image that will be associated with this image
80      required: false
81      default: None
82    kernel:
83      description:
84         - The name of an existing kernel image that will be associated with this image
85      required: false
86      default: None
87    properties:
88      description:
89         - Additional properties to be associated with this image
90      required: false
91      default: {}
92    state:
93      description:
94        - Should the resource be present or absent.
95      choices: [present, absent]
96      default: present
97 requirements: ["shade"]
98 '''
99 
100 EXAMPLES = '''
101 # Upload an image from a local file named cirros-0.3.0-x86_64-disk.img
102 - os_image:
103     auth:
104       auth_url: http://localhost/auth/v2.0
105       username: admin
106       password: passme
107       project_name: admin
108     name: cirros
109     container_format: bare
110     disk_format: qcow2
111     state: present
112     filename: cirros-0.3.0-x86_64-disk.img
113     kernel: cirros-vmlinuz
114     ramdisk: cirros-initrd
115     properties:
116       cpu_arch: x86_64
117       distro: ubuntu
118 '''
119 
120 
121 def main():
122 
123     argument_spec = openstack_full_argument_spec(
124         name              = dict(required=True),
125         disk_format       = dict(default='qcow2', choices=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso']),
126         container_format  = dict(default='bare', choices=['ami', 'aki', 'ari', 'bare', 'ovf', 'ova']),
127         owner             = dict(default=None),
128         min_disk          = dict(default=None),
129         min_ram           = dict(default=None),
130         is_public         = dict(default=False),
131         filename          = dict(default=None),
132         ramdisk           = dict(default=None),
133         kernel            = dict(default=None),
134         properties        = dict(default={}),
135         state             = dict(default='present', choices=['absent', 'present']),
136     )
137     module_kwargs = openstack_module_kwargs()
138     module = AnsibleModule(argument_spec, **module_kwargs)
139 
140     if not HAS_SHADE:
141         module.fail_json(msg='shade is required for this module')
142 
143     try:
144         cloud = shade.openstack_cloud(**module.params)
145 
146         changed = False
147         image = cloud.get_image(name_or_id=module.params['name'])
148 
149         if module.params['state'] == 'present':
150             if not image:
151                 image = cloud.create_image(
152                     name=module.params['name'],
153                     filename=module.params['filename'],
154                     disk_format=module.params['disk_format'],
155                     container_format=module.params['container_format'],
156                     wait=module.params['wait'],
157                     timeout=module.params['timeout']
158                 )
159                 changed = True
160                 if not module.params['wait']:
161                     module.exit_json(changed=changed, image=image, id=image.id)
162 
163             cloud.update_image_properties(
164                 image=image,
165                 kernel=module.params['kernel'],
166                 ramdisk=module.params['ramdisk'],
167                 **module.params['properties'])
168             image = cloud.get_image(name_or_id=image.id)
169             module.exit_json(changed=changed, image=image, id=image.id)
170 
171         elif module.params['state'] == 'absent':
172             if not image:
173                 changed = False
174             else:
175                 cloud.delete_image(
176                     name_or_id=module.params['name'],
177                     wait=module.params['wait'],
178                     timeout=module.params['timeout'])
179                 changed = True
180             module.exit_json(changed=changed)
181 
182     except shade.OpenStackCloudException as e:
183         module.fail_json(msg=e.message, extra_data=e.extra_data)
184 
185 # this is magic, see lib/ansible/module_common.py
186 from ansible.module_utils.basic import *
187 from ansible.module_utils.openstack import *
188 main()
189
```
--- 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/cloud/openstack/os_image.py b/cloud/openstack/os_image.py
--- a/cloud/openstack/os_image.py
+++ b/cloud/openstack/os_image.py
@@ -154,7 +154,8 @@
                     disk_format=module.params['disk_format'],
                     container_format=module.params['container_format'],
                     wait=module.params['wait'],
-                    timeout=module.params['timeout']
+                    timeout=module.params['timeout'],
+                    is_public=module.params['is_public'],
                 )
                 changed = True
                 if not module.params['wait']:

{"golden_diff": "diff --git a/cloud/openstack/os_image.py b/cloud/openstack/os_image.py\n--- a/cloud/openstack/os_image.py\n+++ b/cloud/openstack/os_image.py\n@@ -154,7 +154,8 @@\n                     disk_format=module.params['disk_format'],\n                     container_format=module.params['container_format'],\n                     wait=module.params['wait'],\n-                    timeout=module.params['timeout']\n+                    timeout=module.params['timeout'],\n+                    is_public=module.params['is_public'],\n                 )\n                 changed = True\n                 if not module.params['wait']:\n", "issue": "glance images uploaded via os_image with is_public: true are not public\nI have the following in a playbook:\n\n```\n- name: uploading centos atomic image to glance\n  os_image:\n    name: centos-7-atomic\n    is_public: yes\n    filename: images/centos-7-atomic.qcow2\n```\n\nThe resulting image is not public:\n\n```\n+------------------------------+------------------+\n| Property                     | Value            |\n+------------------------------+------------------+\n| name                         | centos-7-atomic  |\n| visibility                   | private          |\n+------------------------------+------------------+\n```\n\nWhereas if I upload an image from the command line:\n\n```\nglance image-create --file images/centos-7-atomic.qcow2 \\\n  --name larstest --visibility public \\\n  --disk-format qcow2 --container-format bare\n```\n\nThe resulting image is publicly visible:\n\n```\n+------------------+-------------+\n| Property         | Value       |\n+------------------+-------------+\n| name             | larstest    |\n| visibility       | public      |\n+------------------+-------------+\n```\n\n", "before_files": [{"content": "#!/usr/bin/python\n\n# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.\n# Copyright (c) 2013, Benno Joy <benno@ansible.com>\n#\n# This module is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This software is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this software.  If not, see <http://www.gnu.org/licenses/>.\n\n#TODO(mordred): we need to support \"location\"(v1) and \"locations\"(v2)\ntry:\n    import shade\n    HAS_SHADE = True\nexcept ImportError:\n    HAS_SHADE = False\n\n\nDOCUMENTATION = '''\n---\nmodule: os_image\nshort_description: Add/Delete images from OpenStack Cloud\nextends_documentation_fragment: openstack\nversion_added: \"2.0\"\nauthor: \"Monty Taylor (@emonty)\"\ndescription:\n   - Add or Remove images from the OpenStack Image Repository\noptions:\n   name:\n     description:\n        - Name that has to be given to the image\n     required: true\n     default: None\n   disk_format:\n     description:\n        - The format of the disk that is getting uploaded\n     required: false\n     default: qcow2\n   container_format:\n     description:\n        - The format of the container\n     required: false\n     default: bare\n   owner:\n     description:\n        - The owner of the image\n     required: false\n     default: None\n   min_disk:\n     description:\n        - The minimum disk space required to deploy this image\n     required: false\n     default: None\n   min_ram:\n     description:\n        - The minimum ram required to deploy this image\n     required: false\n     default: None\n   is_public:\n     description:\n        - Whether the image can be accessed publicly. Note that publicizing an image requires admin role by default.\n     required: false\n     default: 'yes'\n   filename:\n     description:\n        - The path to the file which has to be uploaded\n     required: false\n     default: None\n   ramdisk:\n     description:\n        - The name of an existing ramdisk image that will be associated with this image\n     required: false\n     default: None\n   kernel:\n     description:\n        - The name of an existing kernel image that will be associated with this image\n     required: false\n     default: None\n   properties:\n     description:\n        - Additional properties to be associated with this image\n     required: false\n     default: {}\n   state:\n     description:\n       - Should the resource be present or absent.\n     choices: [present, absent]\n     default: present\nrequirements: [\"shade\"]\n'''\n\nEXAMPLES = '''\n# Upload an image from a local file named cirros-0.3.0-x86_64-disk.img\n- os_image:\n    auth:\n      auth_url: http://localhost/auth/v2.0\n      username: admin\n      password: passme\n      project_name: admin\n    name: cirros\n    container_format: bare\n    disk_format: qcow2\n    state: present\n    filename: cirros-0.3.0-x86_64-disk.img\n    kernel: cirros-vmlinuz\n    ramdisk: cirros-initrd\n    properties:\n      cpu_arch: x86_64\n      distro: ubuntu\n'''\n\n\ndef main():\n\n    argument_spec = openstack_full_argument_spec(\n        name              = dict(required=True),\n        disk_format       = dict(default='qcow2', choices=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso']),\n        container_format  = dict(default='bare', choices=['ami', 'aki', 'ari', 'bare', 'ovf', 'ova']),\n        owner             = dict(default=None),\n        min_disk          = dict(default=None),\n        min_ram           = dict(default=None),\n        is_public         = dict(default=False),\n        filename          = dict(default=None),\n        ramdisk           = dict(default=None),\n        kernel            = dict(default=None),\n        properties        = dict(default={}),\n        state             = dict(default='present', choices=['absent', 'present']),\n    )\n    module_kwargs = openstack_module_kwargs()\n    module = AnsibleModule(argument_spec, **module_kwargs)\n\n    if not HAS_SHADE:\n        module.fail_json(msg='shade is required for this module')\n\n    try:\n        cloud = shade.openstack_cloud(**module.params)\n\n        changed = False\n        image = cloud.get_image(name_or_id=module.params['name'])\n\n        if module.params['state'] == 'present':\n            if not image:\n                image = cloud.create_image(\n                    name=module.params['name'],\n                    filename=module.params['filename'],\n                    disk_format=module.params['disk_format'],\n                    container_format=module.params['container_format'],\n                    wait=module.params['wait'],\n                    timeout=module.params['timeout']\n                )\n                changed = True\n                if not module.params['wait']:\n                    module.exit_json(changed=changed, image=image, id=image.id)\n\n            cloud.update_image_properties(\n                image=image,\n                kernel=module.params['kernel'],\n                ramdisk=module.params['ramdisk'],\n                **module.params['properties'])\n            image = cloud.get_image(name_or_id=image.id)\n            module.exit_json(changed=changed, image=image, id=image.id)\n\n        elif module.params['state'] == 'absent':\n            if not image:\n                changed = False\n            else:\n                cloud.delete_image(\n                    name_or_id=module.params['name'],\n                    wait=module.params['wait'],\n                    timeout=module.params['timeout'])\n                changed = True\n            module.exit_json(changed=changed)\n\n    except shade.OpenStackCloudException as e:\n        module.fail_json(msg=e.message, extra_data=e.extra_data)\n\n# this is magic, see lib/ansible/module_common.py\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.openstack import *\nmain()\n", "path": "cloud/openstack/os_image.py"}], "after_files": [{"content": "#!/usr/bin/python\n\n# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.\n# Copyright (c) 2013, Benno Joy <benno@ansible.com>\n#\n# This module is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This software is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this software.  If not, see <http://www.gnu.org/licenses/>.\n\n#TODO(mordred): we need to support \"location\"(v1) and \"locations\"(v2)\ntry:\n    import shade\n    HAS_SHADE = True\nexcept ImportError:\n    HAS_SHADE = False\n\n\nDOCUMENTATION = '''\n---\nmodule: os_image\nshort_description: Add/Delete images from OpenStack Cloud\nextends_documentation_fragment: openstack\nversion_added: \"2.0\"\nauthor: \"Monty Taylor (@emonty)\"\ndescription:\n   - Add or Remove images from the OpenStack Image Repository\noptions:\n   name:\n     description:\n        - Name that has to be given to the image\n     required: true\n     default: None\n   disk_format:\n     description:\n        - The format of the disk that is getting uploaded\n     required: false\n     default: qcow2\n   container_format:\n     description:\n        - The format of the container\n     required: false\n     default: bare\n   owner:\n     description:\n        - The owner of the image\n     required: false\n     default: None\n   min_disk:\n     description:\n        - The minimum disk space required to deploy this image\n     required: false\n     default: None\n   min_ram:\n     description:\n        - The minimum ram required to deploy this image\n     required: false\n     default: None\n   is_public:\n     description:\n        - Whether the image can be accessed publicly. Note that publicizing an image requires admin role by default.\n     required: false\n     default: 'yes'\n   filename:\n     description:\n        - The path to the file which has to be uploaded\n     required: false\n     default: None\n   ramdisk:\n     descrption:\n        - The name of an existing ramdisk image that will be associated with this image\n     required: false\n     default: None\n   kernel:\n     descrption:\n        - The name of an existing kernel image that will be associated with this image\n     required: false\n     default: None\n   properties:\n     description:\n        - Additional properties to be associated with this image\n     required: false\n     default: {}\n   state:\n     description:\n       - Should the resource be present or absent.\n     choices: [present, absent]\n     default: present\nrequirements: [\"shade\"]\n'''\n\nEXAMPLES = '''\n# Upload an image from a local file named cirros-0.3.0-x86_64-disk.img\n- os_image:\n    auth:\n      auth_url: http://localhost/auth/v2.0\n      username: admin\n      password: passme\n      project_name: admin\n    name: cirros\n    container_format: bare\n    disk_format: qcow2\n    state: present\n    filename: cirros-0.3.0-x86_64-disk.img\n    kernel: cirros-vmlinuz\n    ramdisk: cirros-initrd\n    properties:\n      cpu_arch: x86_64\n      distro: ubuntu\n'''\n\n\ndef main():\n\n    argument_spec = openstack_full_argument_spec(\n        name              = dict(required=True),\n        disk_format       = dict(default='qcow2', choices=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso']),\n        container_format  = dict(default='bare', choices=['ami', 'aki', 'ari', 'bare', 'ovf', 'ova']),\n        owner             = dict(default=None),\n        min_disk          = dict(default=None),\n        min_ram           = dict(default=None),\n        is_public         = dict(default=False),\n        filename          = dict(default=None),\n        ramdisk           = dict(default=None),\n        kernel            = dict(default=None),\n        properties        = dict(default={}),\n        state             = dict(default='present', choices=['absent', 'present']),\n    )\n    module_kwargs = openstack_module_kwargs()\n    module = AnsibleModule(argument_spec, **module_kwargs)\n\n    if not HAS_SHADE:\n        module.fail_json(msg='shade is required for this module')\n\n    try:\n        cloud = shade.openstack_cloud(**module.params)\n\n        changed = False\n        image = cloud.get_image(name_or_id=module.params['name'])\n\n        if module.params['state'] == 'present':\n            if not image:\n                image = cloud.create_image(\n                    name=module.params['name'],\n                    filename=module.params['filename'],\n                    disk_format=module.params['disk_format'],\n                    container_format=module.params['container_format'],\n                    wait=module.params['wait'],\n                    timeout=module.params['timeout'],\n                    is_public=module.params['is_public'],\n                )\n                changed = True\n                if not module.params['wait']:\n                    module.exit_json(changed=changed, image=image, id=image.id)\n\n            cloud.update_image_properties(\n                image=image,\n                kernel=module.params['kernel'],\n                ramdisk=module.params['ramdisk'],\n                **module.params['properties'])\n            image = cloud.get_image(name_or_id=image.id)\n            module.exit_json(changed=changed, image=image, id=image.id)\n\n        elif module.params['state'] == 'absent':\n            if not image:\n                changed = False\n            else:\n                cloud.delete_image(\n                    name_or_id=module.params['name'],\n                    wait=module.params['wait'],\n                    timeout=module.params['timeout'])\n                changed = True\n            module.exit_json(changed=changed)\n\n    except shade.OpenStackCloudException as e:\n        module.fail_json(msg=e.message, extra_data=e.extra_data)\n\n# this is magic, see lib/ansible/module_common.py\nfrom ansible.module_utils.basic import *\nfrom ansible.module_utils.openstack import *\nmain()\n", "path": "cloud/openstack/os_image.py"}]}