File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/influxdbmod.cpython-310.pyc
Back
o ;jy@ � @ sf d Z ddlZddlZddlmZ ddlZddlmZ zddl Z dZW n ey- dZY nw e� e�ZdZdd � Z d@d d�Zdd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZdAdd�Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Z d(d)� Z! dAd*d+�Z" dAd,d-�Z#d.d/� Z$d0d1� Z%d2d3� Z&d4d5� Z'd6d7� Z( dBd8d9�Z)d:d;� Z*d<d=� Z+d>d?� Z,dS )Ca� InfluxDB - A distributed time series database Module to provide InfluxDB compatibility to Salt (compatible with InfluxDB version 0.9+) :depends: - influxdb Python module (>= 3.0.0) :configuration: This module accepts connection configuration details either as parameters or as configuration settings in /etc/salt/minion on the relevant minions:: influxdb.host: 'localhost' influxdb.port: 8086 influxdb.user: 'root' influxdb.password: 'root' This data can also be passed into pillar. Options passed into opts will overwrite options passed into pillar. Most functions in this module allow you to override or provide some or all of these settings via keyword arguments:: salt '*' influxdb.foo_function influxdb_user='influxadmin' influxdb_password='s3cr1t' would override ``user`` and ``password`` while still using the defaults for ``host`` and ``port``. � N)�Sequence)�STATE_INTERNAL_KEYWORDSTF�influxdbc C s t rtS dS )z. Only load if influxdb lib is present )FzQThe influxdb execution module could not be loaded:influxdb library not available.)�HAS_INFLUXDB�__virtualname__� r r �L/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/influxdbmod.py�__virtual__3 s r c K sz | s t d dd�} |st d dd�}|st d dd�}|s$t d dd�}tD ] }||v r/||= q&tjd ||| |d �|��S )Nz config.optionz influxdb.user�rootzinfluxdb.passwordz influxdb.hostZ localhostz influxdb.porti� )�host�port�username�passwordr )Z__salt__�_STATE_INTERNAL_KEYWORDSr ZInfluxDBClient)Z influxdb_userZinfluxdb_passwordZ influxdb_hostZ influxdb_port�client_args�ignorer r r �_client@ s( ���r c K � t di | ��}|�� S )zv List all InfluxDB databases. CLI Example: .. code-block:: bash salt '*' influxdb.list_dbs Nr )r Zget_list_database�r �clientr r r �list_dbs[ � r c K s$ | dd� t di |��D �v rdS dS )z� Checks if a database exists in InfluxDB. name Name of the database to check. CLI Example: .. code-block:: bash salt '*' influxdb.db_exists <name> c S s g | ]}|d �qS ��namer )�.0�dbr r r � <listcomp>w s zdb_exists.<locals>.<listcomp>TFNr )r �r r r r r � db_existsj s r c K s<