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

Issue:
Helm state is not documented as implemented
##### ISSUE TYPE

 - Documentation Report

##### COMPONENT NAME

`helm`

##### ANSIBLE VERSION

`ansible 2.6.0devel (devel 2fece2f148) last updated 2018/02/09 12:21:02 (GMT +200)`

##### SUMMARY

The `state` of the `helm` module is incorrectly presented to default to `installed` in the documentation. The implemented value for this however is `present`.


Discussion:
Files identified in the description:
* [lib/ansible/modules/cloud/misc/helm.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/misc/helm.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @flaper87
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/cloud/misc/helm.py b/lib/ansible/modules/cloud/misc/helm.py
--- a/lib/ansible/modules/cloud/misc/helm.py
+++ b/lib/ansible/modules/cloud/misc/helm.py
@@ -48,7 +48,7 @@
       - Whether to install C(present), remove C(absent), or purge C(purged) a package.
     required: false
     choices: ['absent', 'purged', 'present']
-    default: "installed"
+    default: "present"
   chart:
     description: |
       A map describing the chart to install. For example:
@@ -84,7 +84,7 @@
       source:
         type: repo
         location: https://kubernetes-charts.storage.googleapis.com
-    state: installed
+    state: present
     name: my-memcached
     namespace: default
 


Test patch:
Repository: ansible/ansible

Issue:
iptables: invert of the uid_owner parameter
##### ISSUE TYPE
 - Feature Idea

##### COMPONENT NAME
module/iptables

##### ANSIBLE VERSION
ansible 2.2.0.0

##### CONFIGURATION
nothing special

##### OS / ENVIRONMENT
N/A

##### SUMMARY
Having a "!" argument to invert the uid_owner parameter will allow to use the module when we want to have explicit rule for all users except one. In my example below I want to block the EC2 metadata service in AWS and not I'm able to do that with iptables module.

##### STEPS TO REPRODUCE
Example task:
```
- name: Block EC2 metadata service for all except root
  iptables:
    chain: OUTPUT
    source: 169.254.169.254
    jump: DROP
    uid_owner: ! root
  become: yes
```
##### EXPECTED RESULTS
Rule looks like:
` -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP`

##### ACTUAL RESULTS
N/A - not implemented


Discussion:
Ping @gebn @bcoca @jimi-c @LinusU
cc @sebastiendarocha
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
+1 I need this too! I'm willing to help work on it. Reading through the iptables module code now. @sebastiendarocha @matthyx 
Hi, there is a proposed fix in https://github.com/ansible/ansible/pull/36073 If people could test and add comments on that PR that would be great. Thanks in advance

Resolving patch:
diff --git a/lib/ansible/modules/system/iptables.py b/lib/ansible/modules/system/iptables.py
--- a/lib/ansible/modules/system/iptables.py
+++ b/lib/ansible/modules/system/iptables.py
@@ -238,7 +238,9 @@
     version_added: "2.1"
   uid_owner:
     description:
-      - Specifies the UID or username to use in match by owner rule.
+      - Specifies the UID or username to use in match by owner rule. From
+        Ansible 2.6 when the C(!) argument is prepended then the it inverts
+        the rule to apply instead to all users except that one specified.
     version_added: "2.1"
   reject_with:
     description:
@@ -437,6 +439,7 @@ def construct_rule(params):
     append_param(rule, params['limit'], '--limit', False)
     append_param(rule, params['limit_burst'], '--limit-burst', False)
     append_match(rule, params['uid_owner'], 'owner')
+    append_match_flag(rule, params['uid_owner'], '--uid-owner', True)
     append_param(rule, params['uid_owner'], '--uid-owner', False)
     if params['jump'] is None:
         append_jump(rule, params['reject_with'], 'REJECT')


Test patch:
Repository: ansible/ansible

Issue:
ec2_tag Docs need updated.
##### ISSUE TYPE
<!--- Pick one below and delete the rest -->
 - Documentation Report

##### COMPONENT NAME
<!---
ec2_tag-->

##### SUMMARY
<!--- Explain the problem briefly -->
https://docs.ansible.com/ansible/latest/ec2_tag_module.html

The excample for a tagging all volumes no longer works. 

##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- name: Ensure all volumes are tagged
  ec2_tag:
    region:  eu-west-1
    resource: '{{ item.id }}'
    state: present
    tags:
      Name: dbserver
      Env: production
  with_items:
    - ec2_vol.volumes

```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->
Expected to tag all volumes.

##### ACTUAL RESULTS
[localhost]: FAILED! => {     "msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'id'

In IRC I was informed the syntax should now be.

    - '{{ ec2_vol.volumes }}'


Discussion:
@jseiser Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. 

Here are the items we could not find in your description:
- ansible version

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: issue_missing_data --->
pinging @dharmabumstead 

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py
--- a/lib/ansible/modules/cloud/amazon/ec2_tag.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py
@@ -94,8 +94,7 @@
     tags:
       Name: dbserver
       Env: production
-  with_items:
-    - ec2_vol.volumes
+  with_items: '{{ ec2_vol.volumes }}'
 
 - name: Get EC2 facts
   action: ec2_facts


Test patch:
Repository: ansible/ansible

Issue:
Documentation Error for ec2_vpc_nacl rules
##### ISSUE TYPE
 - Documentation Report

##### COMPONENT NAME
ec2_vpc_nacl

##### ANSIBLE VERSION
```
ansible 2.4.3.0
  config file = None
  configured module search path = [u'/home/ubuntu/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
```

##### CONFIGURATION

##### OS / ENVIRONMENT
N/A

##### SUMMARY
The example documentation is the wrong way round for ec2_vpc_nacl with respect to the icmp code and type.

##### STEPS TO REPRODUCE
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py#L87 has the order of the `icmp_code` and `icmp_type` inverted compared to the code that parses it https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py#L298

##### EXPECTED RESULTS

##### ACTUAL RESULTS



Discussion:
Files identified in the description:
* [lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @mmochan @willthames
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
I will fix this later today 

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
--- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
@@ -84,7 +84,7 @@
       Project: phoenix
       Description: production DMZ
     ingress: [
-        # rule no, protocol, allow/deny, cidr, icmp_code, icmp_type,
+        # rule no, protocol, allow/deny, cidr, icmp_type, icmp_code,
         #                                             port from, port to
         [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22],
         [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80],


Test patch:
Repository: ansible/ansible

Issue:
Issue in handling error codes thrown on dellos6 devices
<!---
Issue in handling error codes thrown on dellos6 devices.
-->

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
ansible/lib/anisble/plugins/terminal/dellos6.py

##### ANSIBLE VERSION
```
ansible 2.6.0 (devel 78e900cd7f) last updated 2018/02/20 13:05:26 (GMT +550)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
 ```




Discussion:

Resolving patch:
diff --git a/lib/ansible/plugins/terminal/dellos6.py b/lib/ansible/plugins/terminal/dellos6.py
--- a/lib/ansible/plugins/terminal/dellos6.py
+++ b/lib/ansible/plugins/terminal/dellos6.py
@@ -39,14 +39,12 @@ class TerminalModule(TerminalBase):
     terminal_stderr_re = [
         re.compile(br"% ?Error: (?:(?!\bdoes not exist\b)(?!\balready exists\b)(?!\bHost not found\b)(?!\bnot active\b).)*$"),
         re.compile(br"% ?Bad secret"),
-        re.compile(br"invalid input", re.I),
-        re.compile(br"Cannot add a dynamic member to a LAG with static members", re.I),
-        re.compile(br"VLAN ID not found", re.I),
-        re.compile(br"The maximum number of users have already been created.", re.I),
-        re.compile(br"Invalid access level. Access level can be either 0, 1 or 15", re.I),
-        re.compile(br"An invalid interface has been used for this function.", re.I),
-        re.compile(br"Error:Community does not exist.", re.I),
-        re.compile(br"Value is out of range.", re.I),
+        re.compile(br"(\bInterface is part of a port-channel\b)|(\bAn invalid interface has been used for this function\b)"),
+        re.compile(br"(\bThe maximum number of users have already been created\b)|(\bVLAN ID is out of range\b)|(\bUse '-' for range\b)"),
+        re.compile(br"(\binvalid input\b)|(\bVLAN ID not found\b)"),
+        re.compile(br"(\bInvalid access level. Access level can be either 0, 1 or 15\b)|(\bValue is out of range\b)"),
+        re.compile(br"Cannot add(.+)\s(\S+)"),
+        re.compile(br"Error:(.+)\s(\S+)"),
         re.compile(br"(?:incomplete|ambiguous) command", re.I),
         re.compile(br"connection timed out", re.I),
         re.compile(br"'[^']' +returned error code: ?\d+"),


Test patch:
Repository: ansible/ansible

Issue:
Add "Edit on Github" to module documentation too
##### ISSUE TYPE
 - Documentation Report

##### COMPONENT NAME
module docs

##### ANSIBLE VERSION
v2.6

##### SUMMARY
I think it would be equally neat to have an "Edit on Github" link in the module documentation, bringing you to the Github code tree module file. So people can simply make the required changes and turn it into a PR.


Discussion:
Files identified in the description:
* [docs](https://github.com/ansible/ansible/blob/devel/docs)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->

Resolving patch:
diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py
--- a/docs/bin/plugin_formatter.py
+++ b/docs/bin/plugin_formatter.py
@@ -240,6 +240,7 @@ def get_plugin_info(module_dir, limit_to=None, verbose=False):
 
         # save all the information
         module_info[module] = {'path': module_path,
+                               'source': os.path.relpath(module_path, module_dir),
                                'deprecated': deprecated,
                                'aliases': set(),
                                'metadata': metadata,
@@ -413,6 +414,7 @@ def process_plugins(module_map, templates, outputname, output_dir, ansible_versi
 
         doc['option_keys'] = option_names
         doc['filename'] = fname
+        doc['source'] = module_map[module]['source']
         doc['docuri'] = doc['module'].replace('_', '-')
         doc['now_date'] = datetime.date.today().strftime('%Y-%m-%d')
         doc['ansible_version'] = ansible_version


Test patch:
Repository: ansible/ansible

Issue:
Cloudflare DNS does not allow for tls protocol type
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
cloudflare_dns

##### ANSIBLE VERSION
```
ansible 2.4.3.0
  python version = 2.7.14 (default, Feb 17 2018, 10:42:17) [GCC 7.3.1 20180130 (Red Hat 7.3.1-2)]
```

##### CONFIGURATION
N/A

##### OS / ENVIRONMENT
N/A

##### SUMMARY
Cloudflare DNS module does not allow for SRV-records of type tls - only tcp and udp are allowed. Cloudflare also supports tls-type.

##### STEPS TO REPRODUCE

```yaml
- cloudflare_dns:
    domain: my.com
    service: foo
    proto: tls
    port: 3500
    priority: 10
    weight: 20
    type: SRV
    value: fooserver.my.com
```

##### EXPECTED RESULTS
Not failing

##### ACTUAL RESULTS
```
TASK [dns : cloudflare_dns] ***********************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of proto must be one of: tcp,udp, got: tls"}
```



Discussion:
Files identified in the description:
* [lib/ansible/modules/net_tools/cloudflare_dns.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/net_tools/cloudflare_dns.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @andreaso @mgruener
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
resolved_by_pr #36709 

Resolving patch:
diff --git a/lib/ansible/modules/net_tools/cloudflare_dns.py b/lib/ansible/modules/net_tools/cloudflare_dns.py
--- a/lib/ansible/modules/net_tools/cloudflare_dns.py
+++ b/lib/ansible/modules/net_tools/cloudflare_dns.py
@@ -42,9 +42,8 @@
     required: false
     default: "1"
   proto:
-    description: Service protocol. Required for C(type=SRV)
+    description: Service protocol. Required for C(type=SRV). Common values are tcp and udp. (Before Ansible 2.6 only tcp and udp were available).
     required: false
-    choices: [ 'tcp', 'udp' ]
     default: null
   proxied:
     description: Proxy through cloudflare network or just use DNS
@@ -602,7 +601,7 @@ def main():
             account_email=dict(required=True, type='str'),
             port=dict(required=False, default=None, type='int'),
             priority=dict(required=False, default=1, type='int'),
-            proto=dict(required=False, default=None, choices=['tcp', 'udp'], type='str'),
+            proto=dict(required=False, default=None, type='str'),
             proxied=dict(required=False, default=False, type='bool'),
             record=dict(required=False, default='@', aliases=['name'], type='str'),
             service=dict(required=False, default=None, type='str'),


Test patch:
Repository: ansible/ansible

Issue:
ASG rolling update ignores lifecycle hooks
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
ec2_asg

##### ANSIBLE VERSION
```
ansible 2.4.3.0
```

##### CONFIGURATION

##### OS / ENVIRONMENT
N/A

##### SUMMARY
When replacing instances, ASG lifecycle hooks are ignored.
The consequence is that it moves on to the next replacement before the hooks are completed.
It's more evident when the lifecycle hooks take a significant time to complete.


##### STEPS TO REPRODUCE
1. Create an ASG with a lifecycle hooks that take few minutes to complete
2. Update the launch configuration
3. Run a rolling deployment
```yaml
- name: Update launch configuration
  ec2_asg:
    name: test_asg
    launch_config_name: new_test_asg_lc
    desired_capacity: 10
    min_size: 3
    max_size: 20
    wait_for_instances: yes
    replace_all_instances: yes
    replace_batch_size: 2
```

##### EXPECTED RESULTS
There are no more than 2 instances at any time in any of these states:
- Terminating
- Terminating:Wait
- Terminating:Proceed

##### ACTUAL RESULTS
As soon as the instances are in Terminating:Wait module move on to the next batch.
More than 2 instances are in Terminating:Wait or Terminating:Proceed state.



Discussion:

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py
--- a/lib/ansible/modules/cloud/amazon/ec2_asg.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py
@@ -1390,7 +1390,7 @@ def wait_for_term_inst(connection, term_instances):
             lifecycle = instance_facts[i]['lifecycle_state']
             health = instance_facts[i]['health_status']
             module.debug("Instance %s has state of %s,%s" % (i, lifecycle, health))
-            if lifecycle == 'Terminating' or health == 'Unhealthy':
+            if lifecycle.startswith('Terminating') or health == 'Unhealthy':
                 count += 1
         time.sleep(10)
 


Test patch:
Repository: ansible/ansible

Issue:
letsencrypt: problem with authorization to domain matching
##### ISSUE TYPE
Bug Report

##### COMPONENT NAME
letsencrypt

##### ANSIBLE VERSION
```
2.5.0rc3
```

##### SUMMARY
The code matching authorizations with identifiers (i.e. domains) is wrong: it assumes that two arrays correspond to each other, which they in general do not. This bug happens when wildcard and non-wildcard certificates are mixed and when more than one domain is used. So `example.com`, `*.example.com` in one certificate is OK, but `example.org`, `*.example.com` in one certificate triggers this bug. (Asking for `*.example.com`, `example.org` does work; the ACME v2 server apparently puts wildcard domains first and then non-wildcard domains, and otherwise keeps the order from input.)

##### STEPS TO REPRODUCE
Use the Let's Encrypt ACME v2 endpoint to obtain a certificate for domains `examle.com, *.example.com, example.org, *.example.org`, for example (with DNS challenges). Obtaining the certificates will always complain that the wrong TXT entries are provided.

##### EXPECTED RESULTS
Get a valid wildcard certificate (assuming the challenges are set up correctly).

##### ACTUAL RESULTS
Get an error of the form `Authorization for ******** returned in********:  CHALLENGE: ********-01 DETAILS: Incorrect TXT record "********" (and 1 more) found at ********.********;`.



Discussion:

Resolving patch:
diff --git a/lib/ansible/modules/web_infrastructure/letsencrypt.py b/lib/ansible/modules/web_infrastructure/letsencrypt.py
--- a/lib/ansible/modules/web_infrastructure/letsencrypt.py
+++ b/lib/ansible/modules/web_infrastructure/letsencrypt.py
@@ -1150,10 +1150,12 @@ def _new_order_v2(self):
         if info['status'] not in [201]:
             raise ModuleFailException("Error new order: CODE: {0} RESULT: {1}".format(info['status'], result))
 
-        for identifier, auth_uri in zip(result['identifiers'], result['authorizations']):
-            domain = identifier['value']
+        for auth_uri in result['authorizations']:
             auth_data = simple_get(self.module, auth_uri)
             auth_data['uri'] = auth_uri
+            domain = auth_data['identifier']['value']
+            if auth_data.get('wildcard', False):
+                domain = '*.{0}'.format(domain)
             self.authorizations[domain] = auth_data
 
         self.order_uri = info['location']


Test patch:
Repository: ansible/ansible

Issue:
Fixing domain to authorization matching for ACME v2.
##### SUMMARY
Fixes #37557.

##### ISSUE TYPE
Bugfix Pull Request

##### COMPONENT NAME
letsencrypt

##### ANSIBLE VERSION
```
2.5.0rc3
```

##### ADDITIONAL INFORMATION
This fix is for devel, but backporting to stable-2.5 should be trivial.



Discussion:
cc @mgruener @resmo
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
I've tested this one extensively, by creating certificates with different combinations of wildcard and non-wildcard domains (in randomized order) and it seems to work fine. The only errors I got were spurious DNS-related errors (stuff like staging server got NXDOMAIN, but *not* wrong TXT record content).
shipit


Resolving patch:
diff --git a/lib/ansible/modules/web_infrastructure/letsencrypt.py b/lib/ansible/modules/web_infrastructure/letsencrypt.py
--- a/lib/ansible/modules/web_infrastructure/letsencrypt.py
+++ b/lib/ansible/modules/web_infrastructure/letsencrypt.py
@@ -1112,10 +1112,12 @@ def _new_order_v2(self):
         if info['status'] not in [201]:
             self.module.fail_json(msg="Error new order: CODE: {0} RESULT: {1}".format(info['status'], result))
 
-        for identifier, auth_uri in zip(result['identifiers'], result['authorizations']):
-            domain = identifier['value']
+        for auth_uri in result['authorizations']:
             auth_data = simple_get(self.module, auth_uri)
             auth_data['uri'] = auth_uri
+            domain = auth_data['identifier']['value']
+            if auth_data.get('wildcard', False):
+                domain = '*.{0}'.format(domain)
             self.authorizations[domain] = auth_data
 
         self.order_uri = info['location']


Test patch: