Giuseppe Vallarelli has posted comments on this change.

Change subject: vdscli: make __getLocalVdsName more robust
......................................................................


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

(5 inline comments)

Build failure is unrelated to the tests. See few comments.

....................................................
File lib/vdsm/vdscli.py.in
Line 77:         pass
Line 78: 
Line 79: 
Line 80: def __getLocalVdsName(tsPath, out=None):
Line 81:     if not out:
I find if out is None much more readable.
Line 82:         p = subprocess.Popen(['openssl', 'x509', '-noout', '-subject', 
'-in',
Line 83:                               '%s/certs/vdsmcert.pem' % tsPath],
Line 84:                              stdout=subprocess.PIPE, 
stderr=subprocess.PIPE,
Line 85:                              close_fds=True)


Line 84:                              stdout=subprocess.PIPE, 
stderr=subprocess.PIPE,
Line 85:                              close_fds=True)
Line 86:         out, err = p.communicate()
Line 87:         if p.returncode != 0:
Line 88:             return '0'
'0' is the default name you can extract it in a variable so its meaning is more 
clear.
Line 89: 
Line 90:     for keyval in out[:-1].split('/'):
Line 91:         key, val = keyval.split('=')
Line 92:         if key == 'CN':


Line 88:             return '0'
Line 89: 
Line 90:     for keyval in out[:-1].split('/'):
Line 91:         key, val = keyval.split('=')
Line 92:         if key == 'CN':
what does 'CN' mean? Guess current name, control node?
Line 93:             return val
Line 94: 
Line 95:     return '0'
Line 96: 


....................................................
File tests/vdsClientTests.py
Line 125:     def test__getLocalVdsName(self):
Line 126:         cn = getLocalVdsName(
Line 127:             'fake',
Line 128:             'subject= /O=VDSM Certificate/CN=myhost\n')
Line 129:         self.assertEquals('myhost', cn)
You can add a blank line in the middle, it would be more readable (subjective 
matter).
Line 130:         cn = getLocalVdsName(
Line 131:             'fake',
Line 132:             'subject= /CN=myhost/O=VDSM Certificate\n')


Line 129:         self.assertEquals('myhost', cn)
Line 130:         cn = getLocalVdsName(
Line 131:             'fake',
Line 132:             'subject= /CN=myhost/O=VDSM Certificate\n')
Line 133:         self.assertEquals('myhost', cn)
what about the case for '0' ?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I56bf79904cdf5d0dfcba773f096df1d3ec1670fe
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Petr Ĺ ebek <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to