0% found this document useful (0 votes)
4 views3 pages

Dhivyasri - VM Python10ansible

The document details a commit to the Ansible repository that fixes an AttributeError related to removing the first or last rule in the pamd module. The changes include adding 'prev' and 'next' attributes to the PamdRule class and modifying the logic in the PamdService class to handle these attributes correctly. The commit aims to improve code quality and prevent potential errors in rule management.

Uploaded by

goutam_dutta123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Dhivyasri - VM Python10ansible

The document details a commit to the Ansible repository that fixes an AttributeError related to removing the first or last rule in the pamd module. The changes include adding 'prev' and 'next' attributes to the PamdRule class and modifying the logic in the PamdService class to handle these attributes correctly. The commit aims to improve code quality and prevent potential errors in rule management.

Uploaded by

goutam_dutta123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

====================Info Start============================

{
"id": "10",
"repo_name": "ansible",
"Commit URL":
"https://github.com/ansible/ansible/commit/a4b59d021368285490f7cda50c11ac4f7a8030b5
?diff=split",
"Issue URL": "",
"language": "Python"
}

====================Info End====================================

====================Additional Info End====================================

For the Code Change area ,


Line of Code starting with "+" represents that the line is ADDED.
Line of Code starting with "-" represents that the line is REMOVED.

While extracting for desired refinement code please be careful in choosing the
right line of code.

Error types = [ code logic , best practice , code quality , security ]

====================Additional Info End====================================

====================Commit Message Start====================================

pamd: Fix AttributeError when removing the first or last rule (#66398)

====================Commit Message End====================================

====================Code Change Start====================================

diff --git a/lib/ansible/modules/system/pamd.py


b/lib/ansible/modules/system/pamd.py
index 0d8e32b5ae..50da1fcf9e 100644
--- a/lib/ansible/modules/system/pamd.py
+++ b/lib/ansible/modules/system/pamd.py
@@ -351,6 +351,8 @@ class PamdRule(PamdLine):
valid_control_actions = ['ignore', 'bad', 'die', 'ok', 'done', 'reset']

def __init__(self, rule_type, rule_control, rule_path, rule_args=None):


+ self.prev = None
+ self.next = None
self._control = None
self._args = None
self.rule_type = rule_type
@@ -478,7 +480,8 @@ class PamdService(object):
if current_line.matches(rule_type, rule_control, rule_path):
if current_line.prev is not None:
current_line.prev.next = current_line.next
- current_line.next.prev = current_line.prev
+ if current_line.next is not None:
+ current_line.next.prev = current_line.prev
else:
self._head = current_line.next
current_line.next.prev = None

====================Code Change End====================================

====================Additional Info Start====================================

{
"Do you want to reject this annotation": {
"options": [
"1. Yes",
"2. No"
],
"answer": ""
},
"Does the code have a valid bug": {
"options": [
"1. Yes",
"2. No"
],
"answer": ""
},
"Is the provided refinement correct": {
"options": [
"1. Correct",
"2. Not Correct",
"3. Partially Correct"
],
"answer": ""
},

"Annotator Name": "",


"Time taken to annotate (in mins)": ""
}

====================Additional Info End====================================

====================Debug Prompt Start====================================

====================Debug Prompt End=====================================

====================Error Type Start====================================

====================Error Type End=====================================


====================Error Explanation Start====================================

====================Error Explanation End====================================

===================Refinement Summary Start====================================

===================Refinement Summary End====================================

===================Desired Refinement Code


Start====================================

===================Desired Refinement Code End ====================================

===================Alternative Refinement Summary


Start=================================

===================Alternative Refinement Summary


End====================================

===================Alternative Refinement Code


Start====================================

===================Alternative Refinement Code


End====================================

You might also like