Bug 759170

Summary: Method `set' discards return value
Product: [Fedora] Fedora Reporter: Roman Rakus <rrakus>
Component: python-augeasAssignee: Harald Hoyer <harald>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: gregswift, harald, jcholast, nphilipp, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-08 14:29:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Roman Rakus 2011-12-01 15:20:53 UTC
Description of problem:
The return value from `set' method is discarded

Version-Release number of selected component (if applicable):
Any version, upstream version doesn't have it neither

How reproducible:
100%

Steps to Reproduce:
]# python
Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16) 
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import augeas
>>> aug=augeas.Augeas()
>>> aug.set("/files/etc/foo", "bar")
>>> print aug.set("/files/etc/foo", "bar")
None
>>> aug.get("/files/etc/foo")
'bar'
>>>

Comment 1 Nils Philippsen 2011-12-07 15:08:46 UTC
I don't think that this is a bug. The return value of aug_set() is only used to indicate if an error occurred (-1) or not (0). The Python interface maps this to raising an exception in the error case. Contrasting, aug_setm() returns the number of modified nodes, which is returned by the Python setm() method, but nevertheless an exception is raise in the event of an error (instead of returning -1).

Harald, Greg?

Comment 2 Roman Rakus 2011-12-07 15:20:49 UTC
Ah, you're right. Maybe this can be closed. Exception would be enough.