iutil: execWithCallback() and execWithPulseProgress() return an object.
The object contains all the products of the exec: return call, stdout and
stderr. The remaining execWith*() methods can migrate to this too one
day. The advantage now is that lvm() and mdadm() in devicelibs/ don't have
to resort to (possibly broken) hacks to get the error message from their
calls.
---
iutil.py | 15 +++++++++------
storage/dasd.py | 18 ++++++++++--------
storage/devicelibs/lvm.py | 15 +++------------
storage/devicelibs/mdraid.py | 15 +++------------
storage/devicelibs/swap.py | 4 ++--
storage/formats/fs.py | 22 +++++++++++-----------
6 files changed, 38 insertions(+), 51 deletions(-)
+class ExecProduct:
+ def __init__(self, rc, stdout, stderr):
+ self.rc = rc
+ self.stdout = stdout
+ self.stderr = stderr
+
#Python reimplementation of the shell tee process, so we can
#feed the pipe output into two places at the same time
class tee(threading.Thread):
@@ -348,14 +354,11 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
log.critical("exception from waitpid: %s %s" %(e.errno, e.strerror))
closefds()
- # *shrug* no clue why this would happen, but hope that things are fine
- if status is None:
- return 0
if intf:
help = _("Errors like this usually mean there is a problem "
--
1.6.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-20-2010, 08:58 PM
"Brian C. Lane"
iutil: execWithCallback() and execWithPulseProgress() return an object.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/20/2010 08:22 AM, Ales Kozumplik wrote:
> The object contains all the products of the exec: return call, stdout and
> stderr. The remaining execWith*() methods can migrate to this too one
> day. The advantage now is that lvm() and mdadm() in devicelibs/ don't have
> to resort to (possibly broken) hacks to get the error message from their
> calls.
> ---
> iutil.py | 15 +++++++++------
> storage/dasd.py | 18 ++++++++++--------
> storage/devicelibs/lvm.py | 15 +++------------
> storage/devicelibs/mdraid.py | 15 +++------------
> storage/devicelibs/swap.py | 4 ++--
> storage/formats/fs.py | 22 +++++++++++-----------
> 6 files changed, 38 insertions(+), 51 deletions(-)
>
> diff --git a/iutil.py b/iutil.py
> index d026bcf..fb3d6d1 100644
> --- a/iutil.py
> +++ b/iutil.py
> @@ -39,6 +39,12 @@ import logging
> log = logging.getLogger("anaconda")
> program_log = logging.getLogger("program")
>
> +class ExecProduct:
> + def __init__(self, rc, stdout, stderr):
> + self.rc = rc
> + self.stdout = stdout
> + self.stderr = stderr
> +
I would probably just use a dict for something like this. To me classes
are for data structures and the methods that act on them, not just an
easy container for data -- that's what dicts are for. But that is likely
a personal preference
I do like the idea of returning all of this info, either way.
- --
Brian C. Lane <bcl@redhat.com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-24-2010, 12:01 PM
Ales Kozumplik
iutil: execWithCallback() and execWithPulseProgress() return an object.
On 05/20/2010 10:58 PM, Brian C. Lane wrote:
I would probably just use a dict for something like this. To me classes
are for data structures and the methods that act on them, not just an
easy container for data -- that's what dicts are for. But that is likely
a personal preference
I am going to use objects, simply because accessing object.parameter
looks (to me) more aesthetic than object["parameter"]. Plus I know
returning an object here will always be sufficient whatever we decide to
do with it in the future. The only thing a dictionary could offer over
an object is that it's easier to iterate over its keys/values or test
for their presence. But in this case we know all the 'keys' in advance.
Ales
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list