Search is not available for this dataset
text stringlengths 75 104k |
|---|
def get_url(self):
'''
Examine self.id and assign self.url (and self.branch, for git_pillar)
'''
if self.role in ('git_pillar', 'winrepo'):
# With winrepo and git_pillar, the remote is specified in the
# format '<branch> <url>', so that we can get a unique identif... |
def linkdir_walk(self):
'''
Return the expected result of an os.walk on the linkdir, based on the
mountpoint value.
'''
try:
# Use cached linkdir_walk if we've already run this
return self._linkdir_walk
except AttributeError:
self._link... |
def checkout(self):
'''
Checkout the configured branch/tag. We catch an "Exception" class here
instead of a specific exception class because the exceptions raised by
GitPython when running these functions vary in different versions of
GitPython.
'''
tgt_ref = self... |
def init_remote(self):
'''
Initialize/attach to a remote using GitPython. Return a boolean
which will let the calling function know whether or not a new repo was
initialized by this function.
'''
new = False
if not os.listdir(self.cachedir):
# Repo cac... |
def dir_list(self, tgt_env):
'''
Get list of directories for the target environment using GitPython
'''
ret = set()
tree = self.get_tree(tgt_env)
if not tree:
return ret
if self.root(tgt_env):
try:
tree = tree / self.root(tg... |
def envs(self):
'''
Check the refs and return a list of the ones which can be used as salt
environments.
'''
ref_paths = [x.path for x in self.repo.refs]
return self._get_envs_from_ref_paths(ref_paths) |
def _fetch(self):
'''
Fetch the repo. If the local copy was updated, return True. If the
local copy was already up-to-date, return False.
'''
origin = self.repo.remotes[0]
try:
fetch_results = origin.fetch()
except AssertionError:
fetch_res... |
def file_list(self, tgt_env):
'''
Get file list for the target environment using GitPython
'''
files = set()
symlinks = {}
tree = self.get_tree(tgt_env)
if not tree:
# Not found, return empty objects
return files, symlinks
if self.r... |
def find_file(self, path, tgt_env):
'''
Find the specified file in the specified environment
'''
tree = self.get_tree(tgt_env)
if not tree:
# Branch/tag/SHA not found in repo
return None, None, None
blob = None
depth = 0
while True:... |
def get_tree_from_branch(self, ref):
'''
Return a git.Tree object matching a head ref fetched into
refs/remotes/origin/
'''
try:
return git.RemoteReference(
self.repo,
'refs/remotes/origin/{0}'.format(ref)).commit.tree
except Va... |
def get_tree_from_tag(self, ref):
'''
Return a git.Tree object matching a tag ref fetched into refs/tags/
'''
try:
return git.TagReference(
self.repo,
'refs/tags/{0}'.format(ref)).commit.tree
except ValueError:
return None |
def get_tree_from_sha(self, ref):
'''
Return a git.Tree object matching a SHA
'''
try:
return self.repo.rev_parse(ref).tree
except (gitdb.exc.ODBError, AttributeError):
return None |
def write_file(self, blob, dest):
'''
Using the blob object, write the file to the destination path
'''
with salt.utils.files.fopen(dest, 'wb+') as fp_:
blob.stream_data(fp_) |
def checkout(self):
'''
Checkout the configured branch/tag
'''
tgt_ref = self.get_checkout_target()
local_ref = 'refs/heads/' + tgt_ref
remote_ref = 'refs/remotes/origin/' + tgt_ref
tag_ref = 'refs/tags/' + tgt_ref
try:
local_head = self.repo.... |
def clean_stale_refs(self, local_refs=None): # pylint: disable=arguments-differ
'''
Clean stale local refs so they don't appear as fileserver environments
'''
try:
if pygit2.GIT_FETCH_PRUNE:
# Don't need to clean anything, pygit2 can do it by itself
... |
def init_remote(self):
'''
Initialize/attach to a remote using pygit2. Return a boolean which
will let the calling function know whether or not a new repo was
initialized by this function.
'''
# https://github.com/libgit2/pygit2/issues/339
# https://github.com/lib... |
def dir_list(self, tgt_env):
'''
Get a list of directories for the target environment using pygit2
'''
def _traverse(tree, blobs, prefix):
'''
Traverse through a pygit2 Tree object recursively, accumulating all
the empty directories within it in the "b... |
def _fetch(self):
'''
Fetch the repo. If the local copy was updated, return True. If the
local copy was already up-to-date, return False.
'''
origin = self.repo.remotes[0]
refs_pre = self.repo.listall_references()
fetch_kwargs = {}
# pygit2 radically chang... |
def file_list(self, tgt_env):
'''
Get file list for the target environment using pygit2
'''
def _traverse(tree, blobs, prefix):
'''
Traverse through a pygit2 Tree object recursively, accumulating all
the file paths and symlink info in the "blobs" dict
... |
def find_file(self, path, tgt_env):
'''
Find the specified file in the specified environment
'''
tree = self.get_tree(tgt_env)
if not tree:
# Branch/tag/SHA not found in repo
return None, None, None
blob = None
mode = None
depth = 0... |
def get_tree_from_branch(self, ref):
'''
Return a pygit2.Tree object matching a head ref fetched into
refs/remotes/origin/
'''
try:
return self.peel(self.repo.lookup_reference(
'refs/remotes/origin/{0}'.format(ref))).tree
except KeyError:
... |
def get_tree_from_sha(self, ref):
'''
Return a pygit2.Tree object matching a SHA
'''
try:
return self.repo.revparse_single(ref).tree
except (KeyError, TypeError, ValueError, AttributeError):
return None |
def setup_callbacks(self):
'''
Assign attributes for pygit2 callbacks
'''
if PYGIT2_VERSION >= _LooseVersion('0.23.2'):
self.remotecallbacks = pygit2.RemoteCallbacks(
credentials=self.credentials)
if not self.ssl_verify:
# Override ... |
def verify_auth(self):
'''
Check the username and password/keypair info for validity. If valid,
set a 'credentials' attribute consisting of the appropriate Pygit2
credentials object. Return False if a required auth param is not
present. Return True if the required auth parameters... |
def write_file(self, blob, dest):
'''
Using the blob object, write the file to the destination path
'''
with salt.utils.files.fopen(dest, 'wb+') as fp_:
fp_.write(blob.data) |
def init_remotes(self, remotes, per_remote_overrides=(),
per_remote_only=PER_REMOTE_ONLY,
global_only=GLOBAL_ONLY):
'''
Initialize remotes
'''
# The global versions of the auth params (gitfs_user,
# gitfs_password, etc.) default to empty ... |
def clear_old_remotes(self):
'''
Remove cache directories for remotes no longer configured
'''
try:
cachedir_ls = os.listdir(self.cache_root)
except OSError:
cachedir_ls = []
# Remove actively-used remotes from list
for repo in self.remotes... |
def clear_cache(self):
'''
Completely clear cache
'''
errors = []
for rdir in (self.cache_root, self.file_list_cachedir):
if os.path.exists(rdir):
try:
shutil.rmtree(rdir)
except OSError as exc:
e... |
def clear_lock(self, remote=None, lock_type='update'):
'''
Clear update.lk for all remotes
'''
cleared = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches... |
def fetch_remotes(self, remotes=None):
'''
Fetch all remotes and return a boolean to let the calling function know
whether or not any remotes were updated in the process of fetching
'''
if remotes is None:
remotes = []
elif not isinstance(remotes, list):
... |
def lock(self, remote=None):
'''
Place an update.lk
'''
locked = []
errors = []
for repo in self.remotes:
if remote:
# Specific remote URL/pattern was passed, ensure that the URL
# matches or else skip this one
t... |
def update(self, remotes=None):
'''
.. versionchanged:: 2018.3.0
The remotes argument was added. This being a list of remote URLs,
it will only update matching remotes. This actually matches on
repo.id
Execute a git fetch on all of the repos and perform maint... |
def update_intervals(self):
'''
Returns a dictionary mapping remote IDs to their intervals, designed to
be used for variable update intervals in salt.master.FileserverUpdate.
A remote's ID is defined here as a tuple of the GitPython/Pygit2
object's "id" and "name" attributes, wi... |
def verify_provider(self):
'''
Determine which provider to use
'''
if 'verified_{0}_provider'.format(self.role) in self.opts:
self.provider = self.opts['verified_{0}_provider'.format(self.role)]
else:
desired_provider = self.opts.get('{0}_provider'.format(... |
def verify_gitpython(self, quiet=False):
'''
Check if GitPython is available and at a compatible version (>= 0.3.0)
'''
def _recommend():
if PYGIT2_VERSION and 'pygit2' in self.git_providers:
log.error(_RECOMMEND_PYGIT2, self.role, self.role)
if not G... |
def verify_pygit2(self, quiet=False):
'''
Check if pygit2/libgit2 are available and at a compatible version.
Pygit2 must be at least 0.20.3 and libgit2 must be at least 0.20.0.
'''
def _recommend():
if GITPYTHON_VERSION and 'gitpython' in self.git_providers:
... |
def write_remote_map(self):
'''
Write the remote_map.txt
'''
remote_map = salt.utils.path.join(self.cache_root, 'remote_map.txt')
try:
with salt.utils.files.fopen(remote_map, 'w+') as fp_:
timestamp = \
datetime.now().strftime('%d %... |
def do_checkout(self, repo):
'''
Common code for git_pillar/winrepo to handle locking and checking out
of a repo.
'''
time_start = time.time()
while time.time() - time_start <= 5:
try:
return repo.checkout()
except GitLockError as e... |
def envs(self, ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
cache_match = salt.fileserver.check_env_cache(
self.opts,
self.env_cache
)
if cache_match is not Non... |
def find_file(self, path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref, read the file out of git
and send the path to the newly cached file
'''
fnd = {'path': '',
'rel': ''}
if os.path.isabs(path) or ... |
def file_hash(self, load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not all(x in load for x in ('path', 'saltenv')):
return ''... |
def _file_lists(self, load, form):
'''
Return a dict containing the file lists for files and dirs
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not os.path.isdir(self.file_list_cachedir):
try:
... |
def symlink_list(self, load):
'''
Return a dict of all symlinks based on a given path in the repo
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not salt.utils.stringutils.is_hex(load['saltenv']) \
and lo... |
def checkout(self):
'''
Checkout the targeted branches/tags from the git_pillar remotes
'''
self.pillar_dirs = OrderedDict()
self.pillar_linked_dirs = []
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
... |
def link_mountpoint(self, repo):
'''
Ensure that the mountpoint is present in the correct location and
points at the correct path
'''
lcachelink = salt.utils.path.join(repo.linkdir, repo._mountpoint)
lcachedest = salt.utils.path.join(repo.cachedir, repo.root()).rstrip(os.... |
def checkout(self):
'''
Checkout the targeted branches/tags from the winrepo remotes
'''
self.winrepo_dirs = {}
for repo in self.remotes:
cachedir = self.do_checkout(repo)
if cachedir is not None:
self.winrepo_dirs[repo.id] = cachedir |
def _is_exposed(minion):
'''
Check if the minion is exposed, based on the whitelist and blacklist
'''
return salt.utils.stringutils.check_whitelist_blacklist(
minion,
whitelist=__opts__['minionfs_whitelist'],
blacklist=__opts__['minionfs_blacklist']
) |
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Search the environment for the relative path
'''
fnd = {'path': '', 'rel': ''}
if os.path.isabs(path):
return fnd
if tgt_env not in envs():
return fnd
if os.path.basename(path) == 'top.sls':
l... |
def update():
'''
When we are asked to update (regular interval) lets reap the cache
'''
try:
salt.fileserver.reap_fileserver_cache_dir(
os.path.join(__opts__['cachedir'], 'minionfs/hash'),
find_file)
except os.error:
# Hash file won't exist if no files have y... |
def file_hash(load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
path = fnd['path']
ret = {}
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return {}
# if the file... |
def file_list(load):
'''
Return a list of all files on the file server in a specified environment
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if load['saltenv'] not in envs():
return []
mountpoint = salt.utils.url.strip_proto(__opts__['... |
def _subprocess(cmd):
'''
Function to standardize the subprocess call
'''
log.debug('Running: "%s"', ' '.join(cmd))
try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
ret = salt.utils.stringutils.to_unicode(proc.communicate()[0]).strip()
retcode = proc.wait()
... |
def bounce_local(drain=False):
'''
Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
and immediately restarts the Traffic Server node.
drain
This option modifies the restart behavior such that traffic_server
is not shut down until the number of active client co... |
def restart_local(drain=False):
'''
Restart the traffic_manager and traffic_server processes on the local node.
drain
This option modifies the restart behavior such that
``traffic_server`` is not shut down until the number of
active client connections drops to the number given by th... |
def match_metric(regex):
'''
Display the current values of all metrics whose names match the
given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_metric regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('metric', 'match', regex... |
def match_config(regex):
'''
Display the current values of all configuration variables whose
names match the given regular expression.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.match_config regex
'''
if _TRAFFICCTL:
cmd = _traffic_ctl('config'... |
def read_config(*args):
'''
Read Traffic Server configuration variable definitions.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.read_config proxy.config.http.keep_alive_post_out
'''
ret = {}
if _TRAFFICCTL:
cmd = _traffic_ctl('config', 'get')
... |
def set_config(variable, value):
'''
Set the value of a Traffic Server configuration variable.
variable
Name of a Traffic Server configuration variable.
value
The new value to set.
.. versionadded:: 2016.11.0
.. code-block:: bash
salt '*' trafficserver.set_config pro... |
def offline(path):
'''
Mark a cache storage device as offline. The storage is identified by a path
which must match exactly a path specified in storage.config. This removes
the storage from the cache and redirects requests that would have used this
storage to other storage. This has exactly the same... |
def clear_alarms(alarm):
'''
Clear (acknowledge) an alarm event. The arguments are “all” for all current
alarms, a specific alarm number (e.g. ‘‘1’‘), or an alarm string identifier
(e.g. ‘’MGMT_ALARM_PROXY_CONFIG_ERROR’‘).
.. code-block:: bash
salt '*' trafficserver.clear_alarms [all | #ev... |
def node_state(id_):
'''
Libcloud supported node states
'''
states_int = {
0: 'RUNNING',
1: 'REBOOTING',
2: 'TERMINATED',
3: 'PENDING',
4: 'UNKNOWN',
5: 'STOPPED',
6: 'SUSPENDED',
7: 'ERROR',
8: 'PAUSED'}
states_str = {
... |
def check_libcloud_version(reqver=LIBCLOUD_MINIMAL_VERSION, why=None):
'''
Compare different libcloud versions
'''
if not HAS_LIBCLOUD:
return False
if not isinstance(reqver, (list, tuple)):
raise RuntimeError(
'\'reqver\' needs to passed as a tuple or list, i.e., (0, 14... |
def get_node(conn, name):
'''
Return a libcloud node for the named VM
'''
nodes = conn.list_nodes()
for node in nodes:
if node.name == name:
__utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__)
return no... |
def avail_locations(conn=None, call=None):
'''
Return a dict of all available VM locations on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the -... |
def avail_images(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-ima... |
def avail_sizes(conn=None, call=None):
'''
Return a dict of all available VM images on the cloud provider with
relevant data
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes... |
def get_location(conn, vm_):
'''
Return the location object to use
'''
locations = conn.list_locations()
vm_location = config.get_cloud_config_value('location', vm_, __opts__)
if not six.PY3:
vm_location = vm_location.encode(
'ascii', 'salt-cloud-force-ascii'
)
f... |
def get_image(conn, vm_):
'''
Return the image object to use
'''
images = conn.list_images()
vm_image = config.get_cloud_config_value('image', vm_, __opts__)
if not six.PY3:
vm_image = vm_image.encode('ascii', 'salt-cloud-force-ascii')
for img in images:
if isinstance(img.i... |
def get_size(conn, vm_):
'''
Return the VM's size object
'''
sizes = conn.list_sizes()
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
if not vm_size:
return sizes[0]
for size in sizes:
if vm_size and str(vm_size) in (str(size.id), str(size.name)): # pylint: ... |
def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... |
def reboot(name, conn=None):
'''
Reboot a single VM
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
node = get_node(conn, name)
if node is None:
log.error('Unable to find the VM %s', name)
log.info('Rebooting VM: %s', name)
ret = conn.reboot_node(node)
i... |
def list_nodes(conn=None, call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
if not conn:
conn = get_conn() # pylint: disable=E0... |
def list_nodes_full(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with all fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
if not conn:
conn = get_co... |
def list_nodes_select(conn=None, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if not conn:
conn = get_conn() # pylint: disable=E0602
return salt.utils.cloud.list_nodes_select(
list_nodes_full(conn, 'function'), __opts__['query.selection... |
def conn_has_method(conn, method_name):
'''
Find if the provided connection object has a specific method
'''
if method_name in dir(conn):
return True
log.error('Method \'%s\' not yet supported!', method_name)
return False |
def db_exists(name, **client_args):
'''
Checks if a database exists in InfluxDB.
name
Name of the database to check.
CLI Example:
.. code-block:: bash
salt '*' influxdb.db_exists <name>
'''
if name in [db['name'] for db in list_dbs(**client_args)]:
return True
... |
def create_db(name, **client_args):
'''
Create a database.
name
Name of the database to create.
CLI Example:
.. code-block:: bash
salt '*' influxdb.create_db <name>
'''
if db_exists(name, **client_args):
log.info('DB \'%s\' already exists', name)
return Fa... |
def drop_db(name, **client_args):
'''
Drop a database.
name
Name of the database to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_db <name>
'''
if not db_exists(name, **client_args):
log.info('DB \'%s\' does not exist', name)
return False
... |
def user_info(name, **client_args):
'''
Get information about given user.
name
Name of the user for which to get information.
CLI Example:
.. code-block:: bash
salt '*' influxdb.user_info <name>
'''
matching_users = (user for user in list_users(**client_args)
... |
def create_user(name, passwd, admin=False, **client_args):
'''
Create a user.
name
Name of the user to create.
passwd
Password of the new user.
admin : False
Whether the user should have cluster administration
privileges or not.
CLI Example:
.. code-block... |
def set_user_password(name, passwd, **client_args):
'''
Change password of a user.
name
Name of the user for whom to set the password.
passwd
New password of the user.
CLI Example:
.. code-block:: bash
salt '*' influxdb.set_user_password <name> <password>
'''
... |
def grant_admin_privileges(name, **client_args):
'''
Grant cluster administration privileges to a user.
name
Name of the user to whom admin privileges will be granted.
CLI Example:
.. code-block:: bash
salt '*' influxdb.grant_admin_privileges <name>
'''
client = _client(*... |
def revoke_admin_privileges(name, **client_args):
'''
Revoke cluster administration privileges from a user.
name
Name of the user from whom admin privileges will be revoked.
CLI Example:
.. code-block:: bash
salt '*' influxdb.revoke_admin_privileges <name>
'''
client = _c... |
def remove_user(name, **client_args):
'''
Remove a user.
name
Name of the user to remove
CLI Example:
.. code-block:: bash
salt '*' influxdb.remove_user <name>
'''
if not user_exists(name, **client_args):
log.info('User \'%s\' does not exist', name)
return... |
def get_retention_policy(database, name, **client_args):
'''
Get an existing retention policy.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy.
CLI Example:
.. code-block:: bash
salt '*' influxdb.get... |
def retention_policy_exists(database, name, **client_args):
'''
Check if retention policy with given name exists.
database
Name of the database for which the retention policy was
defined.
name
Name of the retention policy to check.
CLI Example:
.. code-block:: bash
... |
def drop_retention_policy(database, name, **client_args):
'''
Drop a retention policy.
database
Name of the database for which the retention policy will be dropped.
name
Name of the retention policy to drop.
CLI Example:
.. code-block:: bash
salt '*' influxdb.drop_re... |
def create_retention_policy(database,
name,
duration,
replication,
default=False,
**client_args):
'''
Create a retention policy.
database
Name of the database ... |
def list_privileges(name, **client_args):
'''
List privileges from a user.
name
Name of the user from whom privileges will be listed.
CLI Example:
.. code-block:: bash
salt '*' influxdb.list_privileges <name>
'''
client = _client(**client_args)
res = {}
for item ... |
def grant_privilege(database, privilege, username, **client_args):
'''
Grant a privilege on a database to a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to gra... |
def revoke_privilege(database, privilege, username, **client_args):
'''
Revoke a privilege on a database from a user.
database
Name of the database to grant the privilege on.
privilege
Privilege to grant. Can be one of 'read', 'write' or 'all'.
username
Name of the user to... |
def continuous_query_exists(database, name, **client_args):
'''
Check if continuous query with given name exists on the database.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to check.
CLI Example:
.. code... |
def get_continuous_query(database, name, **client_args):
'''
Get an existing continuous query.
database
Name of the database for which the continuous query was
defined.
name
Name of the continuous query to get.
CLI Example:
.. code-block:: bash
salt '*' influ... |
def create_continuous_query(database, name, query, resample_time=None, coverage_period=None, **client_args):
'''
Create a continuous query.
database
Name of the database for which the continuous query will be
created on.
name
Name of the continuous query to create.
query
... |
def drop_continuous_query(database, name, **client_args):
'''
Drop a continuous query.
database
Name of the database for which the continuous query will
be drop from.
name
Name of the continuous query to drop.
CLI Example:
.. code-block:: bash
salt '*' influx... |
def _pull_query_results(resultset):
'''
Parses a ResultSet returned from InfluxDB into a dictionary of results,
grouped by series names and optional JSON-encoded grouping tags.
'''
_results = collections.defaultdict(lambda: {})
for _header, _values in resultset.items():
_header, _group_t... |
def query(database, query, **client_args):
'''
Execute a query.
database
Name of the database to query on.
query
InfluxQL query string.
'''
client = _client(**client_args)
_result = client.query(query, database=database)
if isinstance(_result, collections.Sequence):
... |
def _get_recursive_difference(self, type):
'''Returns the recursive diff between dict values'''
if type == 'intersect':
return [recursive_diff(item['old'], item['new']) for item in self._intersect]
elif type == 'added':
return [recursive_diff({}, item) for item in self._a... |
def remove_diff(self, diff_key=None, diff_list='intersect'):
'''Deletes an attribute from all of the intersect objects'''
if diff_list == 'intersect':
for item in self._intersect:
item['old'].pop(diff_key, None)
item['new'].pop(diff_key, None)
if diff_... |
def diffs(self):
'''
Returns a list of dictionaries with key value pairs.
The values are the differences between the items identified by the key.
'''
differences = []
for item in self._get_recursive_difference(type='all'):
if item.diffs:
if ite... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.