Alon Bar-Lev has posted comments on this change.
Change subject: packaging: setup: added FQDN validation to engine-setup-2
......................................................................
Patch Set 1: (4 inline comments)
....................................................
File packaging/setup/plugins/ovirt-engine-setup/config/protocols.py
Line 46: _ADDRESS_RE = re.compile(
Line 47: r'\s+inet (?P<address>'
Line 48: + _IPADDR_PATTERN +
Line 49: r').+'
Line 50: r'\s+(?P<interface>\w+)$'
use verbose re?
Line 51: )
Line 52: _NS_LOOKUP_RE = re.compile(
Line 53: r'Address: ('
Line 54: + _IPADDR_PATTERN +
Line 96: pattern = (self._NS_REVLOOKUP_RE if reverse else
self._NS_LOOKUP_RE)
Line 97: addresses = set()
Line 98: rc, stdout, stderr = self.execute(
Line 99: args=(
Line 100: self.command.get('nslookup'),
I prefer to use dig nslookup is obsolete.
And... better is to use python to lookup instead of calling external program,
no?
Example of something close is here[1]
[1]
http://gerrit.ovirt.org/gitweb?p=ovirt-host-deploy.git;a=blob;f=src/plugins/ovirt-host-deploy/vdsm/bridge.py;hb=HEAD#l590
Line 101: addr,
Line 102: ),
Line 103: raiseOnError=False
Line 104: )
Line 213: fqdn=fqdn
Line 214: )
Line 215: )
Line 216:
Line 217: def _validateFQDN(self, fqdn):
I would have put all the one liners here... no need for single line functions
especially when called once.
Line 218: self._validateFQDNisNotIP(fqdn)
Line 219: self._validateFQDNdomain(fqdn)
Line 220: self._validateFQDNresolvability(fqdn)
Line 221:
Line 305: except RuntimeError as error:
Line 306: if interactive:
Line 307: self.logger.error(
Line 308: _('FQDN is not valid: {error}').format(
Line 309: error=str(error)
no need for str(), and better be consistent... exceptions are always 'e'.
Line 310: )
Line 311: )
Line 312: else:
Line 313: raise
--
To view, visit http://gerrit.ovirt.org/14699
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9764f32ba5e30062532bf11c67756677333c44f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Ofer Schreiber <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches