Change in vdsm[master]: bootstrap: use yum API

danken at redhat.com danken at redhat.com
Wed Sep 19 12:01:52 UTC 2012


Dan Kenigsberg has posted comments on this change.

Change subject: bootstrap: use yum API
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(8 inline comments)

only a shallow  review, sorry.

....................................................
File vds_bootstrap/Makefile.am
Line 43: interface2dir=$(vdsmbootstrapdir)/interface-2
Line 44: dist_interface2_SCRIPTS = \
Line 45: 	vds_bootstrap_complete.py \
Line 46: 	vds_bootstrap.py \
Line 47: 	MiniYum.py \
file names are supposed to be all-lowercase these days. but I do not mind.
Line 48: 	setup
Line 49: 
Line 50: nodist_interface2_SCRIPTS = \
Line 51: 	deployUtil.py


....................................................
File vds_bootstrap/MiniYum.py
Line 177:         )
Line 178: 
Line 179:     @staticmethod
Line 180:     def setup_log_hook(sink=None):
Line 181:         """
see http://www.python.org/dev/peps/pep-0257 about docstring indentation.
Line 182:             logging hack for yum.
Line 183: 
Line 184:             Yum packages uses logging package
Line 185:             intensively, but we have no clue which


Line 409:         """
Line 410:             We dup the stdout as during yum operation
Line 411:             we redirect it.
Line 412:         """
Line 413:         self._stream = None
why's this double assignment? is os.dup expected to fail?
Line 414:         self._stream = os.dup(sys.stdout.fileno())
Line 415: 
Line 416:     def __del__(self):
Line 417:         if self._stream is not None:


Line 434:         return True
Line 435: 
Line 436: 
Line 437: def main():
Line 438:     gluster = False
what sets this to true, and when?
Line 439: 
Line 440:     # BEGIN: PROCESS-INITIALIZATION
Line 441:     miniyumsink = myminiyumsink()
Line 442:     MiniYum.setup_log_hook(miniyumsink)


Line 443:     extraLog = open("/tmp/MiniYum.log", "a")
Line 444:     miniyum = MiniYum(sink=miniyumsink, extraLog=extraLog)
Line 445:     try:
Line 446:         miniyum.selinux_role()
Line 447:     except Exception, e:
such a broad "except" is generally considered evil. What if someone (else!) ever has a typo in a fix to selinux_role()?
Line 448:         print "FAILED: cannot initialize selinux: " + str(e)
Line 449:     # END: PROCESS-INITIALIZATION
Line 450: 
Line 451:     with miniyum:


Line 447:     except Exception, e:
Line 448:         print "FAILED: cannot initialize selinux: " + str(e)
Line 449:     # END: PROCESS-INITIALIZATION
Line 450: 
Line 451:     with miniyum:
would you please explain why you call "with miniyum" multiple times?

wouldn't doing

 with MiniYum(sink=miniyumsink, extraLog=extraLog) as miniyum:

be safer and cleaner?
Line 452:         miniyum.clean()
Line 453: 
Line 454:     with miniyum:
Line 455:         try:


Line 451:     with miniyum:
Line 452:         miniyum.clean()
Line 453: 
Line 454:     with miniyum:
Line 455:         try:
I think this catch-all try-except block should wrap the call to main()
Line 456:             miniyum.remove(('cman',), ignoreErrors=True)
Line 457:             miniyum.install(('qemu-kvm-tools',))
Line 458:             miniyum.installUpdate(('vdsm', 'vdsm-cli'))
Line 459:             if gluster:


....................................................
File vds_bootstrap/vds_bootstrap.py
Line 67:                     filename=LOGFILE,
Line 68:                     filemode='w')
Line 69: 
Line 70: 
Line 71: class myminiyumsink():
I'm a bit confused by this near-reimplementation of a MiniYum class
Line 72: 
Line 73:     def __init__(self):
Line 74:         """
Line 75:             We dup the stdout as during yum operation


--
To view, visit http://gerrit.ovirt.org/8039
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I65796801bc2db7c5abf71c1e9e4ad8ca308138b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Pradipta Banerjee <bpradip at in.ibm.com>
Gerrit-Reviewer: Rodrigo Trujillo <trujillo.unicamp at gmail.com>


More information about the vdsm-patches mailing list