internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ansible/ansible-modules-extras

Issue:
Modules missing EXAMPLES
The following modules are missing EXAMPLES strings:
- ~~packaging/language/cpanm.py~~
- system/open_iscsi.py



Discussion:

Resolving patch:
diff --git a/packaging/language/cpanm.py b/packaging/language/cpanm.py
--- a/packaging/language/cpanm.py
+++ b/packaging/language/cpanm.py
@@ -58,24 +58,31 @@
       - Use the mirror's index file instead of the CPAN Meta DB
     required: false
     default: false
-examples:
-   - code: "cpanm: name=Dancer"
-     description: Install I(Dancer) perl package.
-   - code: "cpanm: name=MIYAGAWA/Plack-0.99_05.tar.gz"
-     description: Install version 0.99_05 of the I(Plack) perl package.
-   - code: "cpanm: name=Dancer locallib=/srv/webapps/my_app/extlib"
-     description: "Install I(Dancer) (U(http://perldancer.org/)) into the specified I(locallib)"
-   - code: "cpanm: from_path=/srv/webapps/my_app/src/"
-     description: Install perl dependencies from local directory.
-   - code: "cpanm: name=Dancer notest=True locallib=/srv/webapps/my_app/extlib"
-     description: Install I(Dancer) perl package without running the unit tests in indicated I(locallib).
-   - code: "cpanm: name=Dancer mirror=http://cpan.cpantesters.org/"
-     description: Install I(Dancer) perl package from a specific mirror
 notes:
    - Please note that U(http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm) must be installed on the remote host.
 author: "Franck Cuny (@franckcuny)"
 '''
 
+EXAMPLES = '''
+# install Dancer perl package
+- cpanm: name=Dancer
+
+# install version 0.99_05 of the Plack perl package
+- cpanm: name=MIYAGAWA/Plack-0.99_05.tar.gz
+
+# install Dancer into the specified locallib
+- cpanm: name=Dancer locallib=/srv/webapps/my_app/extlib
+
+# install perl dependencies from local directory
+- cpanm: from_path=/srv/webapps/my_app/src/
+
+# install Dancer perl package without running the unit tests in indicated locallib
+- cpanm: name=Dancer notest=True locallib=/srv/webapps/my_app/extlib
+
+# install Dancer perl package from a specific mirror
+- cpanm: name=Dancer mirror=http://cpan.cpantesters.org/
+'''
+
 def _is_package_installed(module, name, locallib, cpanm):
     cmd = ""
     if locallib:


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
Firewalld - adding IP to zone doesn't work
Pretty simple line like this just isn't working:

`- firewalld: source=1.2.3.4 state=enabled zone=trusted`

Adding the rule manually with firewall-cmd results in ansible showing OK instead of changed, so it's checking the existing state properly but isn't adding new rules.

This is with a centos 7 machine (up to date) running firewalld 0.3.9



Discussion:
@maxamillion do you have time to look into what's going wrong here?


Resolving patch:
diff --git a/system/firewalld.py b/system/firewalld.py
--- a/system/firewalld.py
+++ b/system/firewalld.py
@@ -76,7 +76,7 @@
 notes:
   - Not tested on any Debian based system.
 requirements: [ 'firewalld >= 0.2.11' ]
-author: "Adam Miller (@maxamillion)" 
+author: "Adam Miller (@maxamillion)"
 '''
 
 EXAMPLES = '''
@@ -138,7 +138,7 @@ def set_port_disabled_permanent(zone, port, protocol):
 
 ####################
 # source handling
-#    
+#
 def get_source(zone, source):
     fw_zone = fw.config().getZoneByName(zone)
     fw_settings = fw_zone.getSettings()
@@ -151,11 +151,13 @@ def add_source(zone, source):
     fw_zone = fw.config().getZoneByName(zone)
     fw_settings = fw_zone.getSettings()
     fw_settings.addSource(source)
+    fw_zone.update(fw_settings)
 
 def remove_source(zone, source):
     fw_zone = fw.config().getZoneByName(zone)
     fw_settings = fw_zone.getSettings()
     fw_settings.removeSource(source)
+    fw_zone.update(fw_settings)
 
 ####################
 # service handling
@@ -191,7 +193,7 @@ def set_service_disabled_permanent(zone, service):
     fw_settings = fw_zone.getSettings()
     fw_settings.removeService(service)
     fw_zone.update(fw_settings)
-    
+
 
 ####################
 # rich rule handling


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
Add more modes to the mysql_replication module
For instance `RESET SLAVE` and `RESET SLAVE ALL`.



Discussion:

Resolving patch:
diff --git a/database/mysql/mysql_replication.py b/database/mysql/mysql_replication.py
--- a/database/mysql/mysql_replication.py
+++ b/database/mysql/mysql_replication.py
@@ -34,7 +34,7 @@
 options:
     mode:
         description:
-            - module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave (START SLAVE), stopslave (STOP SLAVE)
+            - module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave (START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL)
         required: False
         choices:
             - getslave
@@ -42,6 +42,8 @@
             - changemaster
             - stopslave
             - startslave
+            - resetslave
+            - resetslaveall
         default: getslave
     login_user:
         description:
@@ -165,6 +167,24 @@ def stop_slave(cursor):
     return stopped
 
 
+def reset_slave(cursor):
+    try:
+        cursor.execute("RESET SLAVE")
+        reset = True
+    except:
+        reset = False
+    return reset
+
+
+def reset_slave_all(cursor):
+    try:
+        cursor.execute("RESET SLAVE ALL")
+        reset = True
+    except:
+        reset = False
+    return reset
+
+
 def start_slave(cursor):
     try:
         cursor.execute("START SLAVE")
@@ -400,6 +420,18 @@ def main():
             module.exit_json(msg="Slave stopped", changed=True)
         else:
             module.exit_json(msg="Slave already stopped", changed=False)
+    elif mode in "resetslave":
+        reset = reset_slave(cursor)
+        if reset is True:
+            module.exit_json(msg="Slave reset", changed=True)
+        else:
+            module.exit_json(msg="Slave already reset", changed=False)
+    elif mode in "resetslaveall":
+        reset = reset_slave_all(cursor)
+        if reset is True:
+            module.exit_json(msg="Slave reset", changed=True)
+        else:
+            module.exit_json(msg="Slave already reset", changed=False)
 
 # import module snippets
 from ansible.module_utils.basic import *


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
firewalld module traces when port does not include protocol
When using the firewalld module, if you omit the protocol in the `port` argument, you will get a traceback from the following line:

https://github.com/ansible/ansible-modules-extras/blob/09fc1eefe5861a8191c8b89d1c48f09a7fb29558/system/firewalld.py#L237

Since all tracebacks are "bugs" we should probably catch this and say something more helpful.



Discussion:
[module: system/firewalld.py]

Thanks for submitting this bug report. Apologies for taking so long to triage it. Since this bug has been open for a while, we would appreciate if you can verify if you are still seeing the reported behavior in the latest version.

If you are seeing the reported behavior, just let us know and we will leave the bug open and notify the module maintainer.

If you are no longer seeing the reported behavior, please let us know and we will close the bug report.


Resolving patch:
diff --git a/system/firewalld.py b/system/firewalld.py
--- a/system/firewalld.py
+++ b/system/firewalld.py
@@ -233,8 +233,9 @@ def main():
     rich_rule = module.params['rich_rule']
 
     if module.params['port'] != None:
-        port, protocol = module.params['port'].split('/')
-        if protocol == None:
+        try:
+            port, protocol = module.params['port'].split('/')
+        except ValueError:
             module.fail_json(msg='improper port format (missing protocol?)')
     else:
         port = None


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
About option of win_package
I found two issue.

I think Product-ID parameter is not "product_id" , is it "productid"?
Also , it seems the required columns is "yes".

```
fatal: [10.1.1.6]: FAILED! => {"changed": false, "failed": true, "msg": "Missing required argument: productid"
```

Therefore , it take a mistake about "ProductId" below an example on document of win_package:

```
# Playbook example
  - name: Install the vc thingy
    win_package:
      name="Microsoft Visual C thingy"
      path="http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe"
      ProductId="{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}"
      Arguments="/install /passive /norestart"
```



Discussion:
@tksarah -- thanks for submitting this bug report.

@trondhindenes -- letting you know about this. Also: @trondhindenes -- if you get a moment, can you add your github ID to the author line in this module? :) Thanks!

[module: windows/win_package.py]

thanks for letting me know @tksarah. I will have a look at it right away.


Resolving patch:
diff --git a/windows/win_package.py b/windows/win_package.py
--- a/windows/win_package.py
+++ b/windows/win_package.py
@@ -25,6 +25,7 @@
 ---
 module: win_package
 version_added: "1.7"
+author: Trond Hindenes
 short_description: Installs/Uninstalls a installable package, either from local file system or url
 description:
      - Installs or uninstalls a package
@@ -44,9 +45,9 @@
   product_id:
     description:
       - product id of the installed package (used for checking if already installed)
-    required: false
+    required: true
     default: null
-    aliases: []
+    aliases: [productid]
   arguments:
     description:
       - Any arguments the installer needs
@@ -79,7 +80,7 @@
     win_package:
       name="Microsoft Visual C thingy"
       path="http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe"
-      ProductId="{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}"
+      Product_Id="{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}"
       Arguments="/install /passive /norestart"
 
 


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
FirewallD Module Fails with backtrace when firewalld cannot be contacted
**Issue Type:** Bug Report

**Ansible Version**:

```
ansible 2.0.0 (devel 6b419db9fa) last updated 2015/10/21 13:15:31 (GMT +200)
  lib/ansible/modules/core: (detached HEAD dc51e1ae41) last updated 2015/10/21 13:15:36 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD eeeb1264d3) last updated 2015/10/21 13:15:36 (GMT +200)
```

**Environment:**
Ubuntu hosts managing Centos7 targets in multi-environment setups, some of these are Vagrant VMs.

**Summary**:
firewalld is disabled on our Vagrant VMs; there the firewalld tasks fail with a misguiding backtrace.

**Steps To Reproduce:**

```
ansible -m service -a "name=firewalld state=stopped" host1 
ansible -m firewalld -a "port=80/tcp state=enabled permanent=true" host1 
```

**Expected Results:**

Something more informative than the backtrace deep from Python.

**Actual Results:**

```
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 2366, in <module>
  File "<stdin>", line 278, in main
  File "<string>", line 2, in getDefaultZone
  File "/usr/lib/python2.7/site-packages/slip/dbus/polkit.py", line 103, in _enable_proxy
    return func(*p, **k)
  File "<string>", line 2, in getDefaultZone
  File "/usr/lib/python2.7/site-packages/firewall/client.py", line 52, in handle_exceptions
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/firewall/client.py", line 1917, in getDefaultZone
    return dbus_to_python(self.fw.getDefaultZone())
AttributeError: 'NoneType' object has no attribute 'getDefaultZone'

fatal: [host]: FAILED! => {"changed": false, "failed": true, "parsed": false}
```

**Note**:
This report is an almost 1-to-1 copy from https://github.com/ansible/ansible/issues/6911 with the same fix. The patch (actually checking for fw.connected) was undone with https://github.com/ansible/ansible-modules-extras/commit/6f2b61d2d88294ea7938020183ea613b7e5e878d



Discussion:

Resolving patch:
diff --git a/system/firewalld.py b/system/firewalld.py
--- a/system/firewalld.py
+++ b/system/firewalld.py
@@ -97,7 +97,10 @@
 
     from firewall.client import FirewallClient
     fw = FirewallClient()
-    HAS_FIREWALLD = True
+    if not fw.connected:
+        HAS_FIREWALLD = False
+    else:
+        HAS_FIREWALLD = True
 except ImportError:
     HAS_FIREWALLD = False
 


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
pam_limits - documentation is not updated 
`limit_type` choices are `hard`, `soft` in the [documentation](http://docs.ansible.com/ansible/pam_limits_module.html) but in the [code](https://github.com/ansible/ansible-modules-extras/blob/devel/system/pam_limits.py#L95) `-` is supported.

pam_limits - documentation is not updated 
`limit_type` choices are `hard`, `soft` in the [documentation](http://docs.ansible.com/ansible/pam_limits_module.html) but in the [code](https://github.com/ansible/ansible-modules-extras/blob/devel/system/pam_limits.py#L95) `-` is supported.



Discussion:

Resolving patch:
diff --git a/system/pam_limits.py b/system/pam_limits.py
--- a/system/pam_limits.py
+++ b/system/pam_limits.py
@@ -40,7 +40,7 @@
     description:
       - Limit type, see C(man limits) for an explanation
     required: true
-    choices: [ "hard", "soft" ]
+    choices: [ "hard", "soft", "-" ]
   limit_item:
     description:
       - The limit to be set


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
firewalld module needs "python-firewalld" to works (not python3 version).
Hi everyone,

I've [found](http://stackoverflow.com/questions/33904917/ansible-and-fedora23-firewalld-required-for-this-module/33905418#33905418) that firewalld module needs "firewall" library. Normally, it's installed with firewalld, except that Fedora23 installs python3 version of the package. So it doesn't work with Ansible (I suppose, Ansible uses Python2). So I just installed the right library and it worked !

I don't know if there is a way to resolve that in the code but, at least, it would be nice to precise it in the documentation :)

Thank you for reading and sorry if it's not the right place.

firewalld module needs "python-firewalld" to works (not python3 version).
Hi everyone,

I've [found](http://stackoverflow.com/questions/33904917/ansible-and-fedora23-firewalld-required-for-this-module/33905418#33905418) that firewalld module needs "firewall" library. Normally, it's installed with firewalld, except that Fedora23 installs python3 version of the package. So it doesn't work with Ansible (I suppose, Ansible uses Python2). So I just installed the right library and it worked !

I don't know if there is a way to resolve that in the code but, at least, it would be nice to precise it in the documentation :)

Thank you for reading and sorry if it's not the right place.



Discussion:
[module: system/firewalld.py]

@Lerenn -- Thanks for submitting this bug / docs report.

@maxamillion -- thanks in advance for taking a look at this bug report and for your ongoing work in maintaining this module.

[module: system/firewalld.py]

@Lerenn -- Thanks for submitting this bug / docs report.

@maxamillion -- thanks in advance for taking a look at this bug report and for your ongoing work in maintaining this module.


Resolving patch:
diff --git a/system/firewalld.py b/system/firewalld.py
--- a/system/firewalld.py
+++ b/system/firewalld.py
@@ -75,6 +75,7 @@
     default: 0
 notes:
   - Not tested on any Debian based system.
+  - Requires the python2 bindings of firewalld, who may not be installed by default if the distribution switched to python 3 
 requirements: [ 'firewalld >= 0.2.11' ]
 author: "Adam Miller (@maxamillion)"
 '''
@@ -251,7 +252,7 @@ def main():
         module.fail(msg='permanent is a required parameter')
 
     if not HAS_FIREWALLD:
-        module.fail_json(msg='firewalld required for this module')
+        module.fail_json(msg='firewalld and its python 2 module are required for this module')
 
     ## Pre-run version checking
     if FW_VERSION < "0.2.11":


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
FirewallD Module Fails with backtrace when firewalld cannot be contacted
**Issue Type:** Bug Report

**Ansible Version**:

```
ansible 2.0.0 (devel 6b419db9fa) last updated 2015/10/21 13:15:31 (GMT +200)
  lib/ansible/modules/core: (detached HEAD dc51e1ae41) last updated 2015/10/21 13:15:36 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD eeeb1264d3) last updated 2015/10/21 13:15:36 (GMT +200)
```

**Environment:**
Ubuntu hosts managing Centos7 targets in multi-environment setups, some of these are Vagrant VMs.

**Summary**:
firewalld is disabled on our Vagrant VMs; there the firewalld tasks fail with a misguiding backtrace.

**Steps To Reproduce:**

```
ansible -m service -a "name=firewalld state=stopped" host1 
ansible -m firewalld -a "port=80/tcp state=enabled permanent=true" host1 
```

**Expected Results:**

Something more informative than the backtrace deep from Python.

**Actual Results:**

```
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 2366, in <module>
  File "<stdin>", line 278, in main
  File "<string>", line 2, in getDefaultZone
  File "/usr/lib/python2.7/site-packages/slip/dbus/polkit.py", line 103, in _enable_proxy
    return func(*p, **k)
  File "<string>", line 2, in getDefaultZone
  File "/usr/lib/python2.7/site-packages/firewall/client.py", line 52, in handle_exceptions
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/firewall/client.py", line 1917, in getDefaultZone
    return dbus_to_python(self.fw.getDefaultZone())
AttributeError: 'NoneType' object has no attribute 'getDefaultZone'

fatal: [host]: FAILED! => {"changed": false, "failed": true, "parsed": false}
```

**Note**:
This report is an almost 1-to-1 copy from https://github.com/ansible/ansible/issues/6911 with the same fix. The patch (actually checking for fw.connected) was undone with https://github.com/ansible/ansible-modules-extras/commit/6f2b61d2d88294ea7938020183ea613b7e5e878d



Discussion:
[module: system/firewalld.py]

Hi @lightblu -- thanks for submitting this bug report.

@maxamillion -- thanks in advance for taking a look at this bug report and for your ongoing work in maintaining this module. :) 


Resolving patch:
diff --git a/system/firewalld.py b/system/firewalld.py
--- a/system/firewalld.py
+++ b/system/firewalld.py
@@ -282,14 +282,6 @@ def main():
     immediate = module.params['immediate']
     timeout = module.params['timeout']
 
-    ## Check for firewalld running
-    try:
-        if fw.connected == False:
-            module.fail_json(msg='firewalld service must be running')
-    except AttributeError:
-        module.fail_json(msg="firewalld connection can't be established,\
-                version likely too old. Requires firewalld >= 2.0.11")
-
     modification_count = 0
     if service != None:
         modification_count += 1


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
pam_limits - improve documentation
- Adds `comment` parameter
- Adds new examples with:
  - `comment` parameter
  - `value=unlimited`
  - `limit_type=-`

pam_limits - improve documentation
- Adds `comment` parameter
- Adds new examples with:
  - `comment` parameter
  - `value=unlimited`
  - `limit_type=-`



Discussion:

Resolving patch:
diff --git a/system/pam_limits.py b/system/pam_limits.py
--- a/system/pam_limits.py
+++ b/system/pam_limits.py
@@ -78,14 +78,22 @@
       - Modify the limits.conf path.
     required: false
     default: "/etc/security/limits.conf"
+  comment:
+    description:
+      - Comment associated with the limit.
+    required: false
+    default: ''
 '''
 
 EXAMPLES = '''
-# Add or modify limits for the user joe
+# Add or modify nofile soft limit for the user joe
 - pam_limits: domain=joe limit_type=soft limit_item=nofile value=64000
 
-# Add or modify limits for the user joe. Keep or set the maximal value
-- pam_limits: domain=joe limit_type=soft limit_item=nofile value=1000000
+# Add or modify fsize hard limit for the user smith. Keep or set the maximal value.
+- pam_limits: domain=smith limit_type=hard limit_item=fsize value=1000000 use_max=yes
+
+# Add or modify memlock, both soft and hard, limit for the user james with a comment.
+- pam_limits: domain=james limit_type=- limit_item=memlock value=unlimited comment="unlimited memory lock for james"
 '''
 
 def main():


Test patch:
Repository: ansible/ansible-modules-extras

Issue:
cloudstack: cs_volume: Ignore display_volume when account is not Root Admin
Currently cs_volume can not be used for users with not root admin permissions because display_volume is always used due defaulted to `True`. Changing the default to `None` should fix it.

reported by @atsaki 



Discussion:

Resolving patch:
diff --git a/cloud/cloudstack/cs_volume.py b/cloud/cloudstack/cs_volume.py
--- a/cloud/cloudstack/cs_volume.py
+++ b/cloud/cloudstack/cs_volume.py
@@ -275,6 +275,7 @@ def get_volume(self):
             args['account'] = self.get_account(key='name')
             args['domainid'] = self.get_domain(key='id')
             args['projectid'] = self.get_project(key='id')
+            args['zoneid'] = self.get_zone(key='id')
             args['displayvolume'] = self.module.params.get('display_volume')
             args['type'] = 'DATADISK'
 
@@ -444,7 +445,7 @@ def main():
     argument_spec.update(dict(
         name = dict(required=True),
         disk_offering = dict(default=None),
-        display_volume = dict(choices=BOOLEANS, default=True),
+        display_volume = dict(type='bool', default=None),
         max_iops = dict(type='int', default=None),
         min_iops = dict(type='int', default=None),
         size = dict(type='int', default=None),
@@ -452,14 +453,14 @@ def main():
         vm = dict(default=None),
         device_id = dict(type='int', default=None),
         custom_id = dict(default=None),
-        force = dict(choices=BOOLEANS, default=False),
-        shrink_ok = dict(choices=BOOLEANS, default=False),
+        force = dict(type='bool', default=False),
+        shrink_ok = dict(type='bool', default=False),
         state = dict(choices=['present', 'absent', 'attached', 'detached'], default='present'),
         zone = dict(default=None),
         domain = dict(default=None),
         account = dict(default=None),
         project = dict(default=None),
-        poll_async = dict(choices=BOOLEANS, default=True),
+        poll_async = dict(type='bool', default=True),
     ))
 
     module = AnsibleModule(
@@ -490,7 +491,7 @@ def main():
 
         result = acs_vol.get_result(volume)
 
-    except CloudStackException, e:
+    except CloudStackException as e:
         module.fail_json(msg='CloudStackException: %s' % str(e))
 
     module.exit_json(**result)


Test patch: