def check(self): """Check network configuration.""" result = Result() # check ifcfg import for windows and osx users ifcfg_ifaces = ifcfg.interfaces() has_loopback, has_non_loopback, has_multicast = _check_network_config_helper( ifcfg_ifaces) if not _is_unix_like_platform(): if not has_loopback and not has_non_loopback: # no flags found, otherwise one of them should be True. doctor_warn( 'Interface flags are not available on Windows. ' 'Run `ipconfig` to see what interfaces are available.') result.add_warning() return result if not has_loopback: doctor_error('No loopback IP address is found.') result.add_error() if not has_non_loopback: doctor_warn('Only loopback IP address is found.') result.add_warning() if not has_multicast: doctor_warn('No multicast IP address is found.') result.add_warning() return result
def check(self): """Check network configuration.""" result = Result() has_loopback = False has_non_loopback = False has_multicast = False for interface in psutil.net_if_addrs().keys(): flags = InterfaceFlags(interface) has_loopback |= flags.has_loopback has_non_loopback |= flags.has_non_loopback has_multicast |= flags.has_multicast if os.name != 'posix': if not has_loopback and not has_non_loopback: # no flags found, otherwise one of them should be True. doctor_warn( 'Interface flags are not available on Windows. ' 'Run `ipconfig` to see what interfaces are available.') result.add_warning() return result if not has_loopback: doctor_error('No loopback IP address is found.') result.add_error() if not has_non_loopback: doctor_warn('Only loopback IP address is found.') result.add_warning() if not has_multicast: doctor_warn('No multicast IP address is found.') result.add_warning() return result
def check(self): """Check packages within the directory where command is called.""" result = Result() distro_package_vers = get_distro_package_versions() if not distro_package_vers: doctor_error('distro packages info is not found.') result.add_error() local_package_vers = get_local_package_versions() if not local_package_vers: doctor_error('local package info is not found.') result.add_error() if result.error != 0: return result compare_versions(result, local_package_vers, distro_package_vers) return result
def check(self): """Check network configuration.""" result = Result() # check ifcfg import for windows and osx users try: ifcfg_ifaces = ifcfg.interfaces() except NameError: result.add_error( 'ERROR: ifcfg is not imported. Unable to run network check.') return result has_loopback, has_non_loopback, has_multicast = _check_network_config_helper( ifcfg_ifaces) if not has_loopback: result.add_error('ERROR: No loopback IP address is found.') if not has_non_loopback: result.add_warning('Only loopback IP address is found.') if not has_multicast: result.add_warning('No multicast IP address is found.') return result
def check(self): """Check network configuration.""" result = Result() # check ifcfg import for windows and osx users try: ifcfg_ifaces = ifcfg.interfaces() except NameError: doctor_error('`ifcfg` module is not imported. ' 'Unable to run network check.') result.add_error() return result has_loopback, has_non_loopback, has_multicast = _check_network_config_helper( ifcfg_ifaces) if not _is_unix_like_platform(): if not has_loopback and not has_non_loopback: # no flags found, otherwise one of them should be True. doctor_error( 'No flags found. ' 'Run `ipconfig` on Windows or ' 'install `ifconfig` on Unix to check network interfaces.') result.add_error() return result if not has_loopback: doctor_error('No loopback IP address is found.') result.add_error() if not has_non_loopback: doctor_warn('Only loopback IP address is found.') result.add_warning() if not has_multicast: doctor_warn('No multicast IP address is found.') result.add_warning() return result
def check(self): """Check system platform against ROS 2 Distro.""" result = Result() distros = _check_platform_helper() if not distros: result.add_error( 'ERROR: Missing rosdistro info. Unable to check platform.') return result distro_name, distro_info, _ = distros # check distro status if distro_info.get('distribution_status') == 'prerelease': result.add_warning( 'Distribution %s is not fully supported or tested. ' 'To get more consistent features, download a stable version at ' 'https://index.ros.org/doc/ros2/Installation/' % distro_name) elif distro_info.get('distribution_status') == 'end-of-life': result.add_warning( 'Distribution %s is no longer supported or deprecated. ' 'To get the latest features, download the new versions at ' 'https://index.ros.org/doc/ros2/Installation/' % distro_name) return result
def check(self): """Check publisher and subscriber counts.""" result = Result() to_be_checked = get_topic_names() with NodeStrategy(None) as node: for topic in to_be_checked: for pub in node.get_publishers_info_by_topic(topic): for sub in node.get_subscriptions_info_by_topic(topic): compatibility, reason = qos_check_compatible( pub.qos_profile, sub.qos_profile) reason_message = self._strip_leading_warning_or_error_from_string( reason) if compatibility == QoSCompatibility.WARNING: doctor_warn( f"QoS compatibility warning found on topic '{topic}': " f'{reason_message}') result.add_warning() elif compatibility == QoSCompatibility.ERROR: doctor_error( f"QoS compatibility error found on topic '{topic}': " f'{reason_message}') result.add_error() return result
def check(self): """Check network configuration.""" result = Result() # check ifcfg import for windows and osx users try: ifcfg_ifaces = ifcfg.interfaces() except NameError: result.add_error('ERROR: ifcfg is not imported. Unable to run network check.') return result has_loopback, has_non_loopback, has_multicast = _check_network_config_helper(ifcfg_ifaces) if not _is_unix_like_platform(): if not has_loopback and not has_non_loopback: # no flags found, otherwise one of them should be True. print('No flags found. \ Run `ipconfig` on cmd to check network interfaces.') return result if not has_loopback: result.add_error('ERROR: No loopback IP address is found.') if not has_non_loopback: result.add_warning('Only loopback IP address is found.') if not has_multicast: result.add_warning('No multicast IP address is found.') return result
def check(self): """Check packages within the directory where command is called.""" result = Result() try: distro_package_vers = get_distro_package_versions() if not distro_package_vers: result.add_error('ERROR: distro packages info is not found.') except (AttributeError, RuntimeError, URLError): result.add_error( 'ERROR: Unable to fetch package information from rosdistro.') local_package_vers = get_local_package_versions() if not local_package_vers: result.add_error('ERROR: local package info is not found.') if result.error != 0: return result warning_msgs = compare_versions(local_package_vers, distro_package_vers) for msg in warning_msgs: result.add_warning(msg) return result