def setUpClass(cls): super(PluginLoaderTestCase, cls).setUpClass() # Check to see if configs are already registered. # The register_opts is needed when running tests individually. if 'system' not in cfg.CONF: config.register_opts()
def _parse_config(): cli_opts = [ cfg.BoolOpt('verbose', short='v', default=False, help='Print more verbose output'), cfg.StrOpt('trigger-instance-id', short='t', required=True, dest='trigger_instance_id', help='Id of trigger instance'), ] CONF.register_cli_opts(cli_opts) st2cfg.register_opts(ignore_errors=False) CONF(args=sys.argv[1:])
def _parse_config(): cli_opts = [ cfg.BoolOpt("verbose", short="v", default=False, help="Print more verbose output"), cfg.StrOpt( "trigger-instance-id", short="t", required=True, dest="trigger_instance_id", help="Id of trigger instance", ), ] CONF.register_cli_opts(cli_opts) st2cfg.register_opts(ignore_errors=False) CONF(args=sys.argv[1:])
from oslo_config.cfg import NoSuchOptError from stevedore.exception import NoMatches, MultipleMatches from st2common.metrics.utils import check_key from st2common.util.loader import get_plugin_instance from st2common.util.date import get_datetime_utc_now from st2common.exceptions.plugins import PluginLoadError __all__ = [ 'BaseMetricsDriver', 'Timer', 'Counter', 'CounterWithTimer', 'metrics_initialize', 'get_driver' ] if not hasattr(cfg.CONF, 'metrics'): from st2common.config import register_opts register_opts() LOG = logging.getLogger(__name__) PLUGIN_NAMESPACE = 'st2common.metrics.driver' # Stores reference to the metrics driver class instance. # NOTE: This value is populated lazily on the first get_driver() function call METRICS = None class BaseMetricsDriver(object): """ Base class for driver implementations for metric collection """ def time(self, key, time):
def _register_common_opts(): common_config.register_opts()
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from oslo_config import cfg import st2common.config as common_config from st2common.constants.system import VERSION_STRING from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH from st2common.constants.garbage_collection import DEFAULT_COLLECTION_INTERVAL from st2common.constants.garbage_collection import DEFAULT_SLEEP_DELAY common_config.register_opts() CONF = cfg.CONF def parse_args(args=None): cfg.CONF(args=args, version=VERSION_STRING, default_config_files=[DEFAULT_CONFIG_FILE_PATH]) def register_opts(): _register_common_opts() _register_garbage_collector_opts() def get_logging_config_path():
def _register_common_opts(ignore_errors=False): st2cfg.register_opts(ignore_errors=ignore_errors)
def _register_common_opts(): try: common_config.register_opts(ignore_errors=True) except: LOG.exception('Common config registration failed.')
# See the License for the specific language governing permissions and # limitations under the License. """ Configuration options registration and useful routines. """ from __future__ import absolute_import from oslo_config import cfg import st2common.config as common_config from st2common.constants.system import VERSION_STRING from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH common_config.register_opts() CONF = cfg.CONF def parse_args(args=None): cfg.CONF(args=args, version=VERSION_STRING, default_config_files=[DEFAULT_CONFIG_FILE_PATH]) def get_logging_config_path(): return cfg.CONF.exporter.logging def register_opts(): _register_common_opts()
def _register_common_opts(): st2cfg.register_opts()
def _register_common_opts(ignore_errors=False): common_config.register_opts(ignore_errors=ignore_errors)
from st2common.exceptions.plugins import PluginLoadError __all__ = [ 'BaseMetricsDriver', 'Timer', 'Counter', 'CounterWithTimer', 'metrics_initialize', 'get_driver' ] if not hasattr(cfg.CONF, 'metrics'): from st2common.config import register_opts register_opts() LOG = logging.getLogger(__name__) PLUGIN_NAMESPACE = 'st2common.metrics.driver' # Stores reference to the metrics driver class instance. # NOTE: This value is populated lazily on the first get_driver() function call METRICS = None class BaseMetricsDriver(object): """ Base class for driver implementations for metric collection """