internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ansible-collections/community.vmware

Issue:
Invalid return type for vmware_vsan_health_info
<!--- Verify first that your improvement is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
<!--- Explain the problem briefly below, add suggestions to wording or structure -->

The documentation for vmware_vsan_health_info states that the [return type is dict](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L66) but the response is wrapped into a `json.dumps` [converting it to string](https://github.com/ansible-collections/community.vmware/blob/fa19ae68c0a720ab2f12122c9edb2d90d73880e9/plugins/modules/vmware_vsan_health_info.py#L168). I am uncertain whether the return type documentation or the returned object should be adapted, but the current inconsistency should be fixed.

<!--- HINT: Did you know the documentation has an "Edit on GitHub" link on every page ? -->

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME
<!--- Write the short name of the rst file, module, plugin, task or feature below, use your best guess if unsure -->
vmware_vsan_health_info

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible [core 2.14.2]
  config file = None
  configured module search path = ['/var/home/philipp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /var/home/philipp/.local/pipx/venvs/ansible-core/lib64/python3.11/site-packages/ansible
  ansible collection location = /var/home/philipp/.ansible/collections:/usr/share/ansible/collections
  executable location = /var/home/philipp/.local/bin/ansible
  python version = 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/var/home/philipp/.local/pipx/venvs/ansible-core/bin/python)
  jinja version = 3.1.2
  libyaml = True
```



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_vsan_health_info.py b/plugins/modules/vmware_vsan_health_info.py
--- a/plugins/modules/vmware_vsan_health_info.py
+++ b/plugins/modules/vmware_vsan_health_info.py
@@ -167,7 +167,7 @@ def gather_info(self):
 
         health = json.dumps(cluster_health, cls=VmomiSupport.VmomiJSONEncoder, sort_keys=True, strip_dynamic=True)
 
-        self.module.exit_json(changed=False, vsan_health_info=health)
+        self.module.exit_json(changed=False, vsan_health_info=json.loads(health))
 
 
 def main():


Test patch:
Repository: ansible-collections/community.vmware

Issue:
fix regression on vmware_vm_info missing folder
<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
<!--- Explain the problem briefly below -->
We except folder to be queries and included in the response

regression from #1682

```
            if self.module.params.get('show_folder'):
                vm_folder = PyVmomi.get_vm_path(content=self.content, vm_name=vm)
```
but there is no 'show_folder' parameter
##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
<!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below

```

##### COLLECTION VERSION
<!--- Paste verbatim output from "ansible-galaxy collection list <namespace>.<collection>"  between the quotes
for example: ansible-galaxy collection list community.general
-->
```paste below

```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below

```

##### OS / ENVIRONMENT
<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->


##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- HINT: You can paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- Describe what you expected to happen when running the steps above -->


##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes -->
```paste below

```



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_vm_info.py b/plugins/modules/vmware_vm_info.py
--- a/plugins/modules/vmware_vm_info.py
+++ b/plugins/modules/vmware_vm_info.py
@@ -78,6 +78,12 @@
       version_added: '3.5.0'
       default: true
       type: bool
+    show_folder:
+      description:
+        - Show folders
+      version_added: '3.7.0'
+      default: true
+      type: bool
     show_mac_address:
       description:
         - Tags virtual machine's mac address is shown if set to C(true).
@@ -447,6 +453,7 @@ def main():
         show_cluster=dict(type='bool', default=True),
         show_datacenter=dict(type='bool', default=True),
         show_datastore=dict(type='bool', default=True),
+        show_folder=dict(type='bool', default=True),
         show_esxi_hostname=dict(type='bool', default=True),
         show_mac_address=dict(type='bool', default=True),
         show_net=dict(type='bool', default=True),


Test patch:
Repository: ansible-collections/community.vmware

Issue:
[BUG] When network is not found, the error handler raises an exception
https://github.com/ansible-collections/community.vmware/blob/169de3f18053dbf61d7f70bc4b08a2fc7ffc5c19/plugins/modules/vmware_deploy_ovf.py#L502-L504

The function `find_all_networks_by_name` returns a list.

In the format message, `self.params[networks]` is therefore trying to use a list as index, which raises an exception `TypeError: unhashable type 'list'`.


Discussion:
@ansibullbot component vmware_deploy_ovf

@linkdd Yes, I probably forgot the quotes. Tnx, I release fix.
Np, thanks for the quick response 🙂

Resolving patch:
diff --git a/plugins/modules/vmware_deploy_ovf.py b/plugins/modules/vmware_deploy_ovf.py
--- a/plugins/modules/vmware_deploy_ovf.py
+++ b/plugins/modules/vmware_deploy_ovf.py
@@ -275,10 +275,12 @@ def __init__(self, url):
         self.offset = 0
 
     def _parse_url(self, url):
-        exp1 = r"(?P<url>(?:(?P<scheme>[a-zA-Z]+:\/\/)?(?P<hostname>(?:[-a-zA-Z0-9@%_\+~#=]{1,256}\.){1,256}(?:[-a-zA-Z0-9@%_\+~#=]{1,256})))"
-        exp2 = r"(?::(?P<port>[[:digit:]]+))?(?P<path>(?:\/[-a-zA-Z0-9!$&'()*+,\\\/:;=@\[\]._~%]*)*)"
-        exp3 = r"(?P<query>(?:(?:\#|\?)[-a-zA-Z0-9!$&'()*+,\\\/:;=@\[\]._~]*)*))"
-        return re.match(exp1 + exp2 + exp3, url)
+        HTTP_SCHEMA_PATTERN = (
+            r"(?P<url>(?:(?P<scheme>[a-zA-Z]+:\/\/)?(?P<hostname>(?:[-a-zA-Z0-9@%_\+~#=]{1,256}\.){1,256}(?:[-a-zA-Z0-9@%_\+~#=]{1,256})))"
+            r"(?::(?P<port>[[:digit:]]+))?(?P<path>(?:\/[-a-zA-Z0-9!$&'()*+,\\\/:;=@\[\]._~%]*)*)"
+            r"(?P<query>(?:(?:\#|\?)[-a-zA-Z0-9!$&'()*+,\\\/:;=@\[\]._~]*)*))"
+        )
+        return re.match(HTTP_SCHEMA_PATTERN, url)
 
     def _get_thumbprint(self, hostname):
         pem = ssl.get_server_certificate((hostname, 443))
@@ -501,7 +503,7 @@ def get_objects(self):
             # If we have the same network name defined in multiple clusters, check all networks to get the right one
             networks = find_all_networks_by_name(self.content, value, datacenter_name=self.datacenter)
             if not networks:
-                self.module.fail_json(msg=f"'{self.params[networks]}' could not be located")
+                self.module.fail_json(msg=f"Network '{value}' could not be located")
             # Search for the network key of the same network name, that resides in a cluster parameter
             for network in networks:
                 if self.params['cluster']:


Test patch:
Repository: ansible-collections/community.vmware

Issue:
vmware_host_lockdown: Remove states absent and present
##### SUMMARY
Remove deprecated `state`s `absent` and `present`.

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME
vmware_host_lockdown

##### ADDITIONAL INFORMATION
#1514 


Discussion:
@sky-joker `absent` and `present` haven't been removed yet, only deprecated:

https://github.com/ansible-collections/community.vmware/blob/056fd8b59ed9f0b6ea74e9fcbc20e64fad861348/plugins/modules/vmware_host_lockdown.py#L151-L156


I keep this issue open so I don't forget to remove them in the [next major release](https://github.com/ansible-collections/community.vmware/milestone/15).

Resolving patch:
diff --git a/plugins/modules/vmware_host_lockdown.py b/plugins/modules/vmware_host_lockdown.py
--- a/plugins/modules/vmware_host_lockdown.py
+++ b/plugins/modules/vmware_host_lockdown.py
@@ -44,7 +44,7 @@
     - If set to C(strict), all host systems will be set in strict lockdown mode.
     - If host system is already in strict lockdown mode and set to C(strict), no action will be taken.
     default: normal
-    choices: [ disabled, normal, strict, present, absent ]
+    choices: [ disabled, normal, strict ]
     type: str
 extends_documentation_fragment:
 - community.vmware.vmware.documentation
@@ -148,13 +148,6 @@ def ensure(self):
         change_list = []
         desired_state = self.params.get('state')
 
-        if desired_state == 'present':
-            self.module.warn("'present' will be removed in a future version. Please use 'normal' instead.")
-            desired_state = 'normal'
-        elif desired_state == 'absent':
-            self.module.warn("'absent' will be removed in a future version. Please use 'disabled' instead.")
-            desired_state = 'disabled'
-
         for host in self.hosts:
             current_state_api = host.configManager.hostAccessManager.lockdownMode
             current_state = current_state_api[8:].lower()
@@ -193,7 +186,7 @@ def main():
     argument_spec.update(
         cluster_name=dict(type='str', required=False),
         esxi_hostname=dict(type='list', required=False, elements='str'),
-        state=dict(type='str', default='normal', choices=['disabled', 'normal', 'strict', 'present', 'absent'], required=False),
+        state=dict(type='str', default='normal', choices=['disabled', 'normal', 'strict'], required=False),
     )
 
     module = AnsibleModule(


Test patch:
Repository: ansible-collections/community.vmware

Issue:
Return the IP prefixlength/mask in vmware_vm_info
##### SUMMARY
Please add the ip prefixlength/mask to the return of vmware_vm_info

##### ISSUE TYPE
When parsing the data from this module to populate invetory tools like netbox for example, the ip itself is not enough. We need the mask/prefixlength.

##### COMPONENT NAME
vmware_vm_info

##### ADDITIONAL INFORMATION
According to [this](https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Obtain-Guest-Subnet-Mask/td-p/987087) although mask is not directly available, it is possible to get the prefixlength what would be enough.



Discussion:
Yes, I think we could use `prefixLength` from [NetIpConfigInfoIpAddress](https://vdc-repo.vmware.com/vmwb-repository/dcr-public/c476b64b-c93c-4b21-9d76-be14da0148f9/04ca12ad-59b9-4e1c-8232-fd3d4276e52c/SDK/vsphere-ws/docs/ReferenceGuide/vim.net.IpConfigInfo.IpAddress.html) to add this information.

However, I think that changing `1.2.3.4` to `1.2.3.4/24` (just an example) in the result might break existing playbooks. So I've added this to the [4.0.0 milestone](https://github.com/ansible-collections/community.vmware/milestone/15). Breaking changes in major versions are OK; that's what major releases are for, showing there are backwards-incompatible changes.

ETA for 4.0.0 is somewhere around October / November, so you'll have to wait a couple of months. On the other hand, we won't break existing playbooks in a minor release and, since this issue is now part of the milestone, I won't forget it.
That's great!
Thanks!

Resolving patch:
diff --git a/plugins/modules/vmware_vm_info.py b/plugins/modules/vmware_vm_info.py
--- a/plugins/modules/vmware_vm_info.py
+++ b/plugins/modules/vmware_vm_info.py
@@ -254,7 +254,7 @@
         "vm_network": {
             "00:50:56:87:a5:9a": {
               "ipv4": [
-                "10.76.33.228"
+                "10.76.33.228/24"
               ],
               "ipv6": []
             }
@@ -357,11 +357,11 @@ def get_virtual_machines(self):
                         net_dict[device.macAddress] = dict()
                         net_dict[device.macAddress]['ipv4'] = []
                         net_dict[device.macAddress]['ipv6'] = []
-                        for ip_addr in device.ipAddress:
-                            if "::" in ip_addr:
-                                net_dict[device.macAddress]['ipv6'].append(ip_addr)
+                        for ip_addr in device.ipConfig.ipAddress:
+                            if "::" in ip_addr.ipAddress:
+                                net_dict[device.macAddress]['ipv6'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))
                             else:
-                                net_dict[device.macAddress]['ipv4'].append(ip_addr)
+                                net_dict[device.macAddress]['ipv4'].append(ip_addr.ipAddress + "/" + str(ip_addr.prefixLength))
 
             esxi_hostname = None
             esxi_parent = None


Test patch:
Repository: ansible-collections/community.vmware

Issue:
Extend documentation of category_cardinality in vmware_category.py
<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
Please improve the documentation of the parameter `category_cardinality` in [vmware_category.py](https://github.com/ansible-collections/community.vmware/blob/29513ab86b140677bc36c4c4fd655541c4e7a870/plugins/modules/vmware_category.py#L38C5-L38C25) as currently the description is unexpected short: `The category cardinality`.

A good explaination is in [TaggingCategoryModelCardinality](https://developer.vmware.com/apis/vsphere-automation/latest/cis/data-structures/Tagging/CategoryModel/Cardinality/):

```
SINGLE : An object can only be assigned one of the tags in this category. For example, if a category is “Operating System”, then different tags of this category would be “Windows”, “Linux”, and so on. In this case a VM object can be assigned only one of these tags and hence the cardinality of the associated category here is single.

MULTIPLE : An object can be assigned several of the tags in this category. For example, if a category is “Server”, then different tags of this category would be “AppServer”, “DatabaseServer” and so on. In this case a VM object can be assigned more than one of the above tags and hence the cardinality of the associated category here is multiple.
```

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
vmware_category.py



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_category.py b/plugins/modules/vmware_category.py
--- a/plugins/modules/vmware_category.py
+++ b/plugins/modules/vmware_category.py
@@ -39,6 +39,12 @@
       description:
       - The category cardinality.
       - This parameter is ignored, when updating existing category.
+      - V(single) means an object can only be assigned one of the tags in this category.
+        For example, if a O(category_name=Operating System), then different tags of this category would be "Windows", "Linux", and so on.
+        In this case a VM object can be assigned only one of these tags and hence the cardinality of the associated category here is V(single).
+      - V(multiple) means an object can be assigned several of the tags in this category.
+        For example, if a O(category_name=Server), then different tags of this category would be "AppServer", "DatabaseServer" and so on.
+        In this case a VM object can be assigned more than one of the above tags and hence the cardinality of the associated category here is V(multiple).
       choices: ['multiple', 'single']
       default: 'multiple'
       type: str


Test patch:
Repository: ansible-collections/community.vmware

Issue:
Additional keys for sendkey
<!--- Verify first that your feature was not already discussed on GitHub -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
Add the windows key to support keyboard emulation in windows server

##### ISSUE TYPE
- additional key for WINDOWS OS systems

##### COMPONENT NAME
- https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_guest_sendkey.py
- line 251: add             ('WINDOWS', '0x65', [('', [])]),
- compare ref: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf (101 | 0x65 | Windows Menü)
- update documentation respectively

##### ADDITIONAL INFORMATION
Provisioning of Windows server using terraform and ansible. 
Provision other virtual appliances using terraform and ansible



Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_guest_sendkey.py b/plugins/modules/vmware_guest_sendkey.py
--- a/plugins/modules/vmware_guest_sendkey.py
+++ b/plugins/modules/vmware_guest_sendkey.py
@@ -77,7 +77,7 @@
      description:
      - The list of the keys will be sent to the virtual machine.
      - 'Valid values are C(ENTER), C(ESC), C(BACKSPACE), C(TAB), C(SPACE), C(CAPSLOCK), C(HOME), C(DELETE), C(END), C(CTRL_ALT_DEL),
-        C(CTRL_C), C(CTRL_X) and C(F1) to C(F12), C(RIGHTARROW), C(LEFTARROW), C(DOWNARROW), C(UPARROW).'
+        C(CTRL_C), C(CTRL_X) and C(F1) to C(F12), C(RIGHTARROW), C(LEFTARROW), C(DOWNARROW), C(UPARROW), C(WINDOWS).'
      - If both O(keys_send) and O(string_send) are specified, keys in O(keys_send) list will be sent in front of the O(string_send).
      type: list
      default: []
@@ -249,6 +249,7 @@ def __init__(self, module):
             ('LEFTARROW', '0x50', [('', [])]),
             ('DOWNARROW', '0x51', [('', [])]),
             ('UPARROW', '0x52', [('', [])]),
+            ('WINDOWS', '0xe3', [('', [])]),
         ]
 
     @staticmethod


Test patch:
Repository: ansible-collections/community.vmware

Issue:
VSPHERE_FILE examples all still use "host".
##### SUMMARY
<!--- Explain the problem briefly below, add suggestions to wording or structure -->
Examples for VSPHERE_FILE still use the now-no-longer-working "host" keyword in their examples.  For instance:

```
- name: Create an empty file on a datastore
  community.vmware.vsphere_file:
    host: '{{ vhost }}'
    username: '{{ vuser }}'
    password: '{{ vpass }}'
    datacenter: DC1 Someplace
    datastore: datastore1
    path: some/remote/file
    state: touch
  delegate_to: localhost

```
This will no longer work as "host" is no longer a valid keyword:

fatal: [<server>]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (vsphere_file) module: host. Supported parameters include: datacenter, datastore, hostname, password, path, port, proxy_host, proxy_port, state, timeout, username, validate_certs (admin, dest, pass, pwd, user)."}

<!--- HINT: Did you know the documentation has an "Edit on GitHub" link on every page ? -->

##### ISSUE TYPE
- Documentation Report

##### COMPONENT NAME
<!--- Write the short name of the rst file, module, plugin, task or feature below, use your best guess if unsure -->

vsphere_file

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible [core 2.17.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/causer1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/rgautils/general3_11/lib64/python3.11/site-packages/ansible
  ansible collection location = /home/causer1/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/rgautils/general3_11/bin/ansible
  python version = 3.11.7 (main, Jan 26 2024, 15:26:41) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)] (/opt/rgautils/general3_11/bin/python)
  jinja version = 3.1.4
  libyaml = True
```



Discussion:

Resolving patch:
diff --git a/plugins/modules/vsphere_file.py b/plugins/modules/vsphere_file.py
--- a/plugins/modules/vsphere_file.py
+++ b/plugins/modules/vsphere_file.py
@@ -58,7 +58,7 @@
 EXAMPLES = r'''
 - name: Create an empty file on a datastore
   community.vmware.vsphere_file:
-    host: '{{ vhost }}'
+    hostname: '{{ vhost }}'
     username: '{{ vuser }}'
     password: '{{ vpass }}'
     datacenter: DC1 Someplace
@@ -69,7 +69,7 @@
 
 - name: Create a directory on a datastore
   community.vmware.vsphere_file:
-    host: '{{ vhost }}'
+    hostname: '{{ vhost }}'
     username: '{{ vuser }}'
     password: '{{ vpass }}'
     datacenter: DC2 Someplace
@@ -80,7 +80,7 @@
 
 - name: Query a file on a datastore
   community.vmware.vsphere_file:
-    host: '{{ vhost }}'
+    hostname: '{{ vhost }}'
     username: '{{ vuser }}'
     password: '{{ vpass }}'
     datacenter: DC1 Someplace
@@ -92,7 +92,7 @@
 
 - name: Delete a file on a datastore
   community.vmware.vsphere_file:
-    host: '{{ vhost }}'
+    hostname: '{{ vhost }}'
     username: '{{ vuser }}'
     password: '{{ vpass }}'
     datacenter: DC2 Someplace


Test patch:
Repository: vnpy/vnpy

Issue:
活动定单应当排除状态为STATUS_REJECTED 的定单
  
  #----------------------------------------------------------------------
    def updateOrder(self, event):
        """更新委托数据"""
        order = event.dict_['data']        
        self.orderDict[order.vtOrderID] = order
        
        # 如果订单的状态是全部成交或者撤销，则需要从workingOrderDict中移除
        if order.status == STATUS_ALLTRADED or order.status == STATUS_CANCELLED:
            if order.vtOrderID in self.workingOrderDict:
                del self.workingOrderDict[order.vtOrderID]
        # 否则则更新字典中的数据        
        else:
            self.workingOrderDict[order.vtOrderID] = order


Discussion:
OK，我会尽快修复

Resolving patch:
diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py
--- a/vnpy/trader/vtEngine.py
+++ b/vnpy/trader/vtEngine.py
@@ -350,7 +350,7 @@ def updateOrder(self, event):
         self.orderDict[order.vtOrderID] = order
         
         # 如果订单的状态是全部成交或者撤销，则需要从workingOrderDict中移除
-        if order.status == STATUS_ALLTRADED or order.status == STATUS_CANCELLED:
+        if order.status in [STATUS_ALLTRADED, STATUS_REJECTED, STATUS_CANCELLED]:
             if order.vtOrderID in self.workingOrderDict:
                 del self.workingOrderDict[order.vtOrderID]
         # 否则则更新字典中的数据        


Test patch: