[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [master 5/6] 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)

iQEVAwUBS/WiXRF+jBaO/jp/AQK/Kgf+OWRjEE8joIHTldPiaKgLKD1PA4bEXax6
sz6DC56Cf11vfXerbBLggckMz9xDWh4PeMA5BG9IUGSHjYSDkyccvqbUYt9z99bS
D7aJ3W8oNPY1lAEErK51Pz6deHLCbhYT/epdIC5pK7MHSABiPH77RNEJMk9yRKwa
lPU5qvP+Xud8wtUGB2nzDOGTr23YV0948R5aR1SCotNDS6alxospl8l+urOe55dV
mepm832Epo9Pg7RZLGq02Cv6Twfi0GAMSQViZ59fEXSJUb48uOQKM3Aq39muwCne
Mb2WCUEgSb+e21Jlv5LtkLCXXxzvrL4DgjuIsrYBZbjN8SyPg4hIcg==
=D8va
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]