def get_failcounts(env, resource=None, node=None, operation=None, interval=None): # pylint: disable=redefined-outer-name """ List resources failcounts, optionally filtered by a resource, node or op LibraryEnvironment env string resource -- show failcounts for the specified resource only string node -- show failcounts for the specified node only string operation -- show failcounts for the specified operation only string interval -- show failcounts for the specified operation interval only """ report_items = [] if interval is not None and operation is None: report_items.append( reports.prerequisite_option_is_missing("interval", "operation")) if interval is not None: report_items.extend( ValueTimeInterval("interval").validate({"interval": interval})) if report_items: raise LibraryError(*report_items) interval_ms = (None if interval is None else timeout_to_seconds(interval) * 1000) all_failcounts = cib_status.get_resources_failcounts( get_status(env.get_cib())) return cib_status.filter_resources_failcounts(all_failcounts, resource=resource, node=node, operation=operation, interval=interval_ms)
def validate(self, option_dict): return [ reports.prerequisite_option_is_missing(option_name, self._prerequisite_name, self._option_type, self._prerequisite_type) for option_name in self._option_name_list if (option_name in option_dict and self._prerequisite_name not in option_dict) ]
def validate(option_dict): if (option_name in option_dict and prerequisite_option not in option_dict): return [ reports.prerequisite_option_is_missing(option_name, prerequisite_option, option_type, prerequisite_type) ] return []
def validate(option_dict): if ( option_name in option_dict and prerequisite_option not in option_dict ): return [reports.prerequisite_option_is_missing( option_name, prerequisite_option, option_type, prerequisite_type )] return []
def get_failcounts( env, resource=None, node=None, operation=None, interval=None ): # pylint: disable=redefined-outer-name """ List resources failcounts, optionally filtered by a resource, node or op LibraryEnvironment env string resource -- show failcounts for the specified resource only string node -- show failcounts for the specified node only string operation -- show failcounts for the specified operation only string interval -- show failcounts for the specified operation interval only """ report_items = [] if interval is not None and operation is None: report_items.append( reports.prerequisite_option_is_missing("interval", "operation") ) if interval is not None: report_items.extend( value_time_interval("interval")({"interval": interval}) ) if report_items: raise LibraryError(*report_items) interval_ms = ( None if interval is None else timeout_to_seconds(interval) * 1000 ) all_failcounts = cib_status.get_resources_failcounts( get_status(env.get_cib()) ) return cib_status.filter_resources_failcounts( all_failcounts, resource=resource, node=node, operation=operation, interval=interval_ms )