Bug 759170 - Method `set' discards return value
Summary: Method `set' discards return value
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python-augeas
Version: 16
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-01 15:20 UTC by Roman Rakus
Modified: 2014-01-13 00:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-08 14:29:34 UTC
Type: ---


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.