def cli(): """pddf_thermalutil - Command line utility for providing Temp Sensors information""" if os.geteuid() != 0: click.echo("Root privileges are required for this operation") sys.exit(1) # Load the helper class helper = UtilHelper() if not helper.check_pddf_mode(): click.echo( "PDDF mode should be supported and enabled for this platform for this operation" ) sys.exit(1) # Load platform-specific fanutil class global platform_thermalutil try: platform_thermalutil = helper.load_platform_util( PLATFORM_SPECIFIC_MODULE_NAME, PLATFORM_SPECIFIC_CLASS_NAME) except Exception as e: click.echo("Failed to load {}: {}".format( PLATFORM_SPECIFIC_MODULE_NAME, str(e))) sys.exit(2)
def cli(): """psuutil - Command line utility for providing PSU status""" global platform_psuutil global platform_chassis if os.geteuid() != 0: click.echo("Root privileges are required for this operation") sys.exit(1) # Load the helper class helper = UtilHelper() if not helper.check_pddf_mode(): click.echo( "PDDF mode should be supported and enabled for this platform for this operation" ) sys.exit(1) # Load new platform api class try: import sonic_platform.platform platform_chassis = sonic_platform.platform.Platform().get_chassis() except Exception as e: click.echo("Failed to load chassis due to {}".format(str(e))) # Load platform-specific psuutil class if 2.0 implementation is not present if platform_chassis is None: try: platform_psuutil = helper.load_platform_util( PLATFORM_SPECIFIC_MODULE_NAME, PLATFORM_SPECIFIC_CLASS_NAME) except Exception as e: click.echo("Failed to load {}: {}".format( PLATFORM_SPECIFIC_MODULE_NAME, str(e))) sys.exit(2)