def _customization(self):

        interactive = self.environment[
            ohostedcons.NetworkEnv.GATEWAY
        ] is None
        valid = False
        while not valid:
            if interactive:
                self.environment[
                    ohostedcons.NetworkEnv.GATEWAY
                ] = self.dialog.queryString(
                    name='OVEHOSTED_GATEWAY',
                    note=_(
                        'Please indicate a pingable gateway IP address '
                        '[@DEFAULT@]: '
                    ),
                    prompt=True,
                    caseSensitive=True,
                    default=self._get_default_gw(),
                )
            valid = ohostedutil.check_is_pingable(
                self,
                self.environment[
                    ohostedcons.NetworkEnv.GATEWAY
                ]
            )
            if not valid:
                if not interactive:
                    raise RuntimeError(_('Specified gateway is not pingable'))
                else:
                    self.logger.error(_('Specified gateway is not pingable'))
    def _customization(self):

        interactive = self.environment[
            ohostedcons.NetworkEnv.GATEWAY
        ] is None
        valid = False
        while not valid:
            if interactive:
                self.environment[
                    ohostedcons.NetworkEnv.GATEWAY
                ] = self.dialog.queryString(
                    name='OVEHOSTED_GATEWAY',
                    note=_(
                        'Please indicate a pingable gateway IP address '
                        '[@DEFAULT@]: '
                    ),
                    prompt=True,
                    caseSensitive=True,
                    default=self._get_default_gw(),
                )
            valid = ohostedutil.check_is_pingable(
                self,
                self.environment[
                    ohostedcons.NetworkEnv.GATEWAY
                ]
            )
            if not valid:
                if not interactive:
                    raise RuntimeError(_('Specified gateway is not pingable'))
                else:
                    self.logger.error(_('Specified gateway is not pingable'))
Example #3
0
 def _getFreeIPAddress(self, myip):
     myipna = netaddr.IPNetwork(myip)
     for ip in myipna.iter_hosts():
         if ip != myip.ip:
             if not ohostedutil.check_is_pingable(self, ip):
                 return ip
     return ''
 def _getFreeIPAddress(self, myip):
     myipna = netaddr.IPNetwork(myip)
     for ip in myipna.iter_hosts():
         if ip != myip.ip:
             if not ohostedutil.check_is_pingable(self, ip):
                 return ip
     return ''
    def _customization(self):

        interactive = self.environment[
            ohostedcons.NetworkEnv.NETWORK_TEST
        ] is None
        valid = False
        while not valid:
            if interactive:
                self.environment[
                    ohostedcons.NetworkEnv.NETWORK_TEST
                ] = self.dialog.queryString(
                    name='OVEHOSTED_NETWORK_TEST',
                    note=_(
                        'Please specify which way the network connectivity '
                        'should be checked (@VALUES@) [@DEFAULT@]: '
                    ),
                    validValues=(
                        'ping',
                        'dns',
                        'tcp',
                        'none'
                    ),
                    prompt=True,
                    caseSensitive=True,
                    default='dns',
                )

            network_test = self.environment[
                ohostedcons.NetworkEnv.NETWORK_TEST
            ]

            if network_test == 'ping':
                valid = ohostedutil.check_is_pingable(
                    self,
                    self.environment[
                        ohostedcons.NetworkEnv.GATEWAY
                    ]
                )
                if not valid:
                    self._propagate_error(
                        interactive,
                        _('Specified gateway is not pingable'))
            elif network_test == 'dns':
                valid = self._check_dns()
                if not valid:
                    self._propagate_error(
                        interactive,
                        _('DNS query failed'))
            elif network_test == 'tcp':
                valid = self._customize_tcp()
Example #6
0
    def _customization(self):

        interactive = self.environment[
            ohostedcons.NetworkEnv.NETWORK_TEST] is None
        valid = False
        while not valid:
            if interactive:
                self.environment[
                    ohostedcons.NetworkEnv.
                    NETWORK_TEST] = self.dialog.queryString(
                        name='OVEHOSTED_NETWORK_TEST',
                        note=_(
                            'Please specify which way the network connectivity '
                            'should be checked (@VALUES@) [@DEFAULT@]: '),
                        validValues=('ping', 'dns', 'tcp', 'none'),
                        prompt=True,
                        caseSensitive=True,
                        default='dns',
                    )

            network_test = self.environment[
                ohostedcons.NetworkEnv.NETWORK_TEST]

            if network_test == 'ping':
                valid = ohostedutil.check_is_pingable(
                    self, self.environment[ohostedcons.NetworkEnv.GATEWAY])
                if not valid:
                    self._propagate_error(
                        interactive, _('Specified gateway is not pingable'))
            elif network_test == 'dns':
                valid = self._check_dns()
                if not valid:
                    self._propagate_error(interactive, _('DNS query failed'))
            elif network_test == 'tcp':
                valid = self._customize_tcp()
            elif network_test == 'none':
                valid = True