repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/returners/highstate_return.py
_lookup_style
python
def _lookup_style(element, names): ''' Lookup style by either element name or the list of classes ''' return _STYLES.get('_'+element, '') + \ ''.join([_STYLES.get(name, '') for name in names])
Lookup style by either element name or the list of classes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L168-L173
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_generate_html_table
python
def _generate_html_table(data, out, level=0, extra_style=''): ''' Generate a single table of data ''' print('<table style="{0}">'.format( _lookup_style('table', ['table' + six.text_type(level)])), file=out) firstone = True row_style = 'row' + six.text_type(level) cell_style = 'cell...
Generate a single table of data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L176-L269
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_generate_html
python
def _generate_html(data, out): ''' Generate report data as HTML ''' print('<html>', file=out) print('<body>', file=out) _generate_html_table(data, out, 0) print('</body>', file=out) print('</html>', file=out)
Generate report data as HTML
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L272-L280
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_dict_to_name_value
python
def _dict_to_name_value(data): ''' Convert a dictionary to a list of dictionaries to facilitate ordering ''' if isinstance(data, dict): sorted_data = sorted(data.items(), key=lambda s: s[0]) result = [] for name, value in sorted_data: if isinstance(value, dict): ...
Convert a dictionary to a list of dictionaries to facilitate ordering
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L283-L297
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_generate_states_report
python
def _generate_states_report(sorted_data): ''' Generate states report ''' states = [] for state, data in sorted_data: module, stateid, name, function = state.split('_|-') module_function = '.'.join((module, function)) result = data.get('result', '') single = [ ...
Generate states report
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L300-L332
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_generate_report
python
def _generate_report(ret, setup): ''' Generate report dictionary ''' retdata = ret.get('return', {}) sorted_data = sorted( retdata.items(), key=lambda s: s[1].get('__run_num__', 0) ) total = 0 failed = 0 changed = 0 duration = 0.0 # gather stats for _,...
Generate report dictionary
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L335-L411
[ "def _generate_states_report(sorted_data):\n '''\n Generate states report\n '''\n states = []\n for state, data in sorted_data:\n module, stateid, name, function = state.split('_|-')\n module_function = '.'.join((module, function))\n result = data.get('result', '')\n singl...
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
_produce_output
python
def _produce_output(report, failed, setup): ''' Produce output from the report dictionary generated by _generate_report ''' report_format = setup.get('report_format', 'yaml') log.debug('highstate output format: %s', report_format) if report_format == 'json': report_text = salt.utils.js...
Produce output from the report dictionary generated by _generate_report
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L425-L493
null
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/returners/highstate_return.py
returner
python
def returner(ret): ''' Check highstate return information and possibly fire off an email or save a file. ''' setup = _get_options(ret) log.debug('highstate setup %s', setup) report, failed = _generate_report(ret, setup) if report: _produce_output(report, failed, setup)
Check highstate return information and possibly fire off an email or save a file.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L496-L507
[ "def _get_options(ret):\n '''\n Return options\n '''\n attrs = {\n 'report_everything': 'report_everything',\n 'report_changes': 'report_changes',\n 'report_failures': 'report_failures',\n 'failure_function': 'failure_function',\n 'success_function': 'success_function'...
# -*- coding: utf-8 -*- ''' Return the results of a highstate (or any other state function that returns data in a compatible format) via an HTML email or HTML file. .. versionadded:: 2017.7.0 Similar results can be achieved by using the smtp returner with a custom template, except an attempt at writing such a templat...
saltstack/salt
salt/modules/out.py
out_format
python
def out_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configu...
Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs Arguments ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L37-L61
[ "def out_format(data, out, opts=None, **kwargs):\n '''\n Return the formatted outputter string for the passed data\n '''\n return try_printout(data, out, opts, **kwargs)\n" ]
# -*- coding: utf-8 -*- ''' Output Module ============= .. versionadded:: 2018.3.0 Execution module that processes JSON serializable data and returns string having the format as processed by the outputters. Although this does not bring much value on the CLI, it turns very handy in applications that require human rea...
saltstack/salt
salt/modules/out.py
string_format
python
def string_format(data, out='nested', opts=None, **kwargs): ''' Return the outputter formatted string, removing the ANSI escape sequences. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dict...
Return the outputter formatted string, removing the ANSI escape sequences. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L64-L88
[ "def string_format(data, out, opts=None, **kwargs):\n '''\n Return the formatted outputter string, removing the ANSI escape sequences.\n '''\n raw_output = try_printout(data, out, opts, **kwargs)\n ansi_escape = re.compile(r'\\x1b[^m]*m')\n return ansi_escape.sub('', raw_output)\n" ]
# -*- coding: utf-8 -*- ''' Output Module ============= .. versionadded:: 2018.3.0 Execution module that processes JSON serializable data and returns string having the format as processed by the outputters. Although this does not bring much value on the CLI, it turns very handy in applications that require human rea...
saltstack/salt
salt/modules/out.py
html_format
python
def html_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted string as HTML. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default...
Return the formatted string as HTML. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs Arguments to sent to the outputter...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L91-L115
[ "def html_format(data, out, opts=None, **kwargs):\n '''\n Return the formatted string as HTML.\n '''\n ansi_escaped_string = string_format(data, out, opts, **kwargs)\n return ansi_escaped_string.replace(' ', '&nbsp;').replace('\\n', '<br />')\n" ]
# -*- coding: utf-8 -*- ''' Output Module ============= .. versionadded:: 2018.3.0 Execution module that processes JSON serializable data and returns string having the format as processed by the outputters. Although this does not bring much value on the CLI, it turns very handy in applications that require human rea...
saltstack/salt
salt/states/zcbuildout.py
installed
python
def installed(name, config='buildout.cfg', quiet=False, parts=None, user=None, env=(), buildout_ver=None, test_release=False, distribute=None, new_st=None, offline=False, ...
Install buildout in a specific directory It is a thin wrapper to modules.buildout.buildout name directory to execute in quiet do not output console & logs config buildout config to use (default: buildout.cfg) parts specific buildout parts to run user ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zcbuildout.py#L121-L241
[ "def __salt(fn):\n if fn not in FN_CACHE:\n FN_CACHE[fn] = __salt__[fn]\n return FN_CACHE[fn]\n", "def _ret_status(exec_status=None,\n name='',\n comment='',\n result=None,\n quiet=False,\n changes=None):\n if not changes:\...
# -*- coding: utf-8 -*- ''' Management of zc.buildout ========================= This module is inspired from minitage's buildout maker (https://github.com/minitage/minitage/blob/master/src/minitage/core/makers/buildout.py) .. versionadded:: 2016.3.0 .. note:: This state module is beta; the API is subject to cha...
saltstack/salt
salt/modules/dummyproxy_pkg.py
version
python
def version(*names, **kwargs): ''' Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. CLI Example: .. code-block:: bash salt '*' pkg.version <package name> ...
Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. CLI Example: .. code-block:: bash salt '*' pkg.version <package name> salt '*' pkg.version <package1> <package2>...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dummyproxy_pkg.py#L55-L76
null
# -*- coding: utf-8 -*- ''' Package support for the dummy proxy used by the test suite ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import salt.utils.data import salt.utils.platform from salt.ext import six log = logging.getLogger(__name__) # Defin...
saltstack/salt
salt/platform/win.py
set_user_perm
python
def set_user_perm(obj, perm, sid): ''' Set an object permission for the given user sid ''' info = ( win32security.OWNER_SECURITY_INFORMATION | win32security.GROUP_SECURITY_INFORMATION | win32security.DACL_SECURITY_INFORMATION ) sd = win32security.GetUserObjectSecurity(obj...
Set an object permission for the given user sid
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L972-L998
null
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
grant_winsta_and_desktop
python
def grant_winsta_and_desktop(th): ''' Grant the token's user access to the current process's window station and desktop. ''' current_sid = win32security.GetTokenInformation(th, win32security.TokenUser)[0] # Add permissions for the sid to the current windows station and thread id. # This prev...
Grant the token's user access to the current process's window station and desktop.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1001-L1012
[ "def set_user_perm(obj, perm, sid):\n '''\n Set an object permission for the given user sid\n '''\n info = (\n win32security.OWNER_SECURITY_INFORMATION |\n win32security.GROUP_SECURITY_INFORMATION |\n win32security.DACL_SECURITY_INFORMATION\n )\n sd = win32security.GetUserObje...
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
enumerate_tokens
python
def enumerate_tokens(sid=None, session_id=None, privs=None): ''' Enumerate tokens from any existing processes that can be accessed. Optionally filter by sid. ''' for p in psutil.process_iter(): if p.pid == 0: continue try: ph = win32api.OpenProcess(win32con.PR...
Enumerate tokens from any existing processes that can be accessed. Optionally filter by sid.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1062-L1115
[ "def dup_token(th):\n '''\n duplicate the access token\n '''\n # TODO: is `duplicate_token` the same?\n sec_attr = win32security.SECURITY_ATTRIBUTES()\n sec_attr.bInheritHandle = True\n return win32security.DuplicateTokenEx(\n th,\n win32security.SecurityImpersonation,\n win32...
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
impersonate_sid
python
def impersonate_sid(sid, session_id=None, privs=None): ''' Find an existing process token for the given sid and impersonate the token. ''' for tok in enumerate_tokens(sid, session_id, privs): tok = dup_token(tok) elevate_token(tok) if win32security.ImpersonateLoggedOnUser(tok) ==...
Find an existing process token for the given sid and impersonate the token.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1118-L1128
[ "def enumerate_tokens(sid=None, session_id=None, privs=None):\n '''\n Enumerate tokens from any existing processes that can be accessed.\n Optionally filter by sid.\n '''\n for p in psutil.process_iter():\n if p.pid == 0:\n continue\n try:\n ph = win32api.OpenProce...
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
dup_token
python
def dup_token(th): ''' duplicate the access token ''' # TODO: is `duplicate_token` the same? sec_attr = win32security.SECURITY_ATTRIBUTES() sec_attr.bInheritHandle = True return win32security.DuplicateTokenEx( th, win32security.SecurityImpersonation, win32con.MAXIMUM_ALL...
duplicate the access token
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1131-L1144
null
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
elevate_token
python
def elevate_token(th): ''' Set all token priviledges to enabled ''' # Get list of privileges this token contains privileges = win32security.GetTokenInformation( th, win32security.TokenPrivileges) # Create a set of all privileges to be enabled enable_privs = set() for luid, flags...
Set all token priviledges to enabled
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1147-L1162
null
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/platform/win.py
make_inheritable
python
def make_inheritable(token): '''Create an inheritable handle''' return win32api.DuplicateHandle( win32api.GetCurrentProcess(), token, win32api.GetCurrentProcess(), 0, 1, win32con.DUPLICATE_SAME_ACCESS )
Create an inheritable handle
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1165-L1174
null
# -*- coding: utf-8 -*- ''' Windows specific utility functions, this module should be imported in a try, except block because it is only applicable on Windows platforms. Much of what is here was adapted from the following: https://stackoverflow.com/a/43233332 http://stackoverflow.com/questions/29566330 ''' f...
saltstack/salt
salt/states/boto_cloudfront.py
present
python
def present( name, config, tags, region=None, key=None, keyid=None, profile=None, ): ''' Ensure the CloudFront distribution is present. name (string) Name of the CloudFront distribution config (dict) Configuration for the distribution tags (dict) ...
Ensure the CloudFront distribution is present. name (string) Name of the CloudFront distribution config (dict) Configuration for the distribution tags (dict) Tags to associate with the distribution region (string) Region to connect to key (string) Secret ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L73-L237
[ "def _yaml_safe_dump(attrs):\n '''\n Safely dump YAML using a readable flow style\n '''\n dumper_name = 'IndentedSafeOrderedDumper'\n dumper = __utils__['yaml.get_dumper'](dumper_name)\n return __utils__['yaml.dump'](\n attrs,\n default_flow_style=False,\n Dumper=dumper)\n" ]
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
_fix_quantities
python
def _fix_quantities(tree): ''' Stupidly simple function to fix any Items/Quantity disparities inside a DistributionConfig block before use. Since AWS only accepts JSON-encodable data types, this implementation is "good enough" for our purposes. ''' if isinstance(tree, dict): tree = {k: _...
Stupidly simple function to fix any Items/Quantity disparities inside a DistributionConfig block before use. Since AWS only accepts JSON-encodable data types, this implementation is "good enough" for our purposes.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L240-L256
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
distribution_present
python
def distribution_present(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure the given CloudFront distribution exists in the described state. The implementation of this function, and all those following, is orthagonal to that of :py:mod:`boto_cloudfront.present <salt.states...
Ensure the given CloudFront distribution exists in the described state. The implementation of this function, and all those following, is orthagonal to that of :py:mod:`boto_cloudfront.present <salt.states.boto_cloudfront.present>`. Resources created with :py:mod:`boto_cloudfront.present <salt.states.bo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L259-L575
[ "def _fix_quantities(tree):\n '''\n Stupidly simple function to fix any Items/Quantity disparities inside a\n DistributionConfig block before use. Since AWS only accepts JSON-encodable\n data types, this implementation is \"good enough\" for our purposes.\n '''\n if isinstance(tree, dict):\n ...
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
oai_bucket_policy_present
python
def oai_bucket_policy_present(name, Bucket, OAI, Policy, region=None, key=None, keyid=None, profile=None): ''' Ensure the given policy exists on an S3 bucket, granting access for the given origin access identity to do the things specified in the policy. name The na...
Ensure the given policy exists on an S3 bucket, granting access for the given origin access identity to do the things specified in the policy. name The name of the state definition Bucket The S3 bucket which CloudFront needs access to. Note that this policy is exclusive - it will b...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L578-L695
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
route53_alias_present
python
def route53_alias_present(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure a Route53 Alias exists and is pointing at the given CloudFront distribution. An ``A`` record is always created, and if IPV6 is enabled on the given distribution, an ``AAAA`` record will be created as w...
Ensure a Route53 Alias exists and is pointing at the given CloudFront distribution. An ``A`` record is always created, and if IPV6 is enabled on the given distribution, an ``AAAA`` record will be created as well. Also be aware that Alias records for CloudFront distributions are only permitted in non-pri...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L698-L834
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
distribution_absent
python
def distribution_absent(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure a distribution with the given Name tag does not exist. Note that CloudFront does not allow directly deleting an enabled Distribution. If such is requested, Salt will attempt to first update the dist...
Ensure a distribution with the given Name tag does not exist. Note that CloudFront does not allow directly deleting an enabled Distribution. If such is requested, Salt will attempt to first update the distribution's status to Disabled, and once that returns success, to then delete the resource. THIS CA...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L837-L955
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
origin_access_identity_present
python
def origin_access_identity_present(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure a given CloudFront Origin Access Identity exists. .. note:: Due to the unavailibity of ANY other way to store stateful idempotency information about Origin Access Identities (incl...
Ensure a given CloudFront Origin Access Identity exists. .. note:: Due to the unavailibity of ANY other way to store stateful idempotency information about Origin Access Identities (including resource tags), the Comment attribute (as the only user-settable attribute without weird se...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L958-L1078
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/states/boto_cloudfront.py
origin_access_identity_absent
python
def origin_access_identity_absent(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure a given CloudFront Origin Access Identity is absent. name The name of the state definition. Name (string) Name of the resource (for purposes of Salt's idempotency). If not ...
Ensure a given CloudFront Origin Access Identity is absent. name The name of the state definition. Name (string) Name of the resource (for purposes of Salt's idempotency). If not provided, the value of ``name`` will be used. Id (string) The Resource ID of a CloudFront orig...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L1081-L1178
null
# -*- coding: utf-8 -*- ''' Manage CloudFront distributions .. versionadded:: 2018.3.0 Create, update and destroy CloudFront distributions. This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtain...
saltstack/salt
salt/modules/snap.py
install
python
def install(pkg, channel=None, refresh=False): ''' Install the specified snap package from the specified channel. Returns a dictionary of "result" and "output". pkg The snap package name channel Optional. The snap channel to install from, eg "beta" refresh : False If T...
Install the specified snap package from the specified channel. Returns a dictionary of "result" and "output". pkg The snap package name channel Optional. The snap channel to install from, eg "beta" refresh : False If True, use "snap refresh" instead of "snap install". ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snap.py#L26-L60
null
# -*- coding: utf-8 -*- ''' Manage snap packages via Salt :depends: snapd for distribution ''' from __future__ import absolute_import, print_function, unicode_literals import subprocess import salt.utils.path SNAP_BINARY_NAME = 'snap' __virtualname__ = 'snap' def __virtual__(): if salt.utils.path.which('sna...
saltstack/salt
salt/modules/snap.py
remove
python
def remove(pkg): ''' Remove the specified snap package. Returns a dictionary of "result" and "output". pkg The package name ''' ret = {'result': None, 'output': ""} try: ret['output'] = subprocess.check_output([SNAP_BINARY_NAME, 'remove', pkg]) ret['result'] = True e...
Remove the specified snap package. Returns a dictionary of "result" and "output". pkg The package name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snap.py#L73-L86
null
# -*- coding: utf-8 -*- ''' Manage snap packages via Salt :depends: snapd for distribution ''' from __future__ import absolute_import, print_function, unicode_literals import subprocess import salt.utils.path SNAP_BINARY_NAME = 'snap' __virtualname__ = 'snap' def __virtual__(): if salt.utils.path.which('sna...
saltstack/salt
salt/modules/snap.py
versions_installed
python
def versions_installed(pkg): ''' Query which version(s) of the specified snap package are installed. Returns a list of 0 or more dictionaries. pkg The package name ''' try: # Try to run it, merging stderr into output output = subprocess.check_output([SNAP_BINARY_NAME, '...
Query which version(s) of the specified snap package are installed. Returns a list of 0 or more dictionaries. pkg The package name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/snap.py#L90-L119
null
# -*- coding: utf-8 -*- ''' Manage snap packages via Salt :depends: snapd for distribution ''' from __future__ import absolute_import, print_function, unicode_literals import subprocess import salt.utils.path SNAP_BINARY_NAME = 'snap' __virtualname__ = 'snap' def __virtual__(): if salt.utils.path.which('sna...
saltstack/salt
salt/modules/virtualenv_mod.py
create
python
def create(path, venv_bin=None, system_site_packages=False, distribute=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, pip=False, symlinks=None, upgrade=None...
Create a virtualenv path The path to the virtualenv to be created venv_bin The name (and optionally path) of the virtualenv command. This can also be set globally in the pillar data as ``venv_bin``. Defaults to ``pyvenv`` or ``virtualenv``, depending on what is installed. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virtualenv_mod.py#L49-L316
[ "def _install_script(source, cwd, python, user, saltenv='base', use_vt=False):\n if not salt.utils.platform.is_windows():\n tmppath = salt.utils.files.mkstemp(dir=cwd)\n else:\n tmppath = __salt__['cp.cache_file'](source, saltenv)\n\n if not salt.utils.platform.is_windows():\n fn_ = __...
# -*- coding: utf-8 -*- ''' Create virtualenv environments. .. versionadded:: 0.17.0 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import glob import shutil import logging import os import sys # Import salt libs import salt.utils.files import salt.utils.path import...
saltstack/salt
salt/modules/virtualenv_mod.py
get_site_packages
python
def get_site_packages(venv): ''' Return the path to the site-packages directory of a virtualenv venv Path to the virtualenv. CLI Example: .. code-block:: bash salt '*' virtualenv.get_site_packages /path/to/my/venv ''' bin_path = _verify_virtualenv(venv) ret = __salt_...
Return the path to the site-packages directory of a virtualenv venv Path to the virtualenv. CLI Example: .. code-block:: bash salt '*' virtualenv.get_site_packages /path/to/my/venv
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virtualenv_mod.py#L319-L343
[ "def _verify_virtualenv(venv_path):\n bin_path = os.path.join(venv_path, 'bin/python')\n if not os.path.exists(bin_path):\n raise CommandExecutionError(\n 'Path \\'{0}\\' does not appear to be a virtualenv: bin/python not found.'.format(venv_path)\n )\n return bin_path\n" ]
# -*- coding: utf-8 -*- ''' Create virtualenv environments. .. versionadded:: 0.17.0 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import glob import shutil import logging import os import sys # Import salt libs import salt.utils.files import salt.utils.path import...
saltstack/salt
salt/modules/virtualenv_mod.py
get_distribution_path
python
def get_distribution_path(venv, distribution): ''' Return the path to a distribution installed inside a virtualenv .. versionadded:: 2016.3.0 venv Path to the virtualenv. distribution Name of the distribution. Note, all non-alphanumeric characters will be converted to dashe...
Return the path to a distribution installed inside a virtualenv .. versionadded:: 2016.3.0 venv Path to the virtualenv. distribution Name of the distribution. Note, all non-alphanumeric characters will be converted to dashes. CLI Example: .. code-block:: bash sal...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virtualenv_mod.py#L346-L378
[ "def _verify_virtualenv(venv_path):\n bin_path = os.path.join(venv_path, 'bin/python')\n if not os.path.exists(bin_path):\n raise CommandExecutionError(\n 'Path \\'{0}\\' does not appear to be a virtualenv: bin/python not found.'.format(venv_path)\n )\n return bin_path\n", "def _...
# -*- coding: utf-8 -*- ''' Create virtualenv environments. .. versionadded:: 0.17.0 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import glob import shutil import logging import os import sys # Import salt libs import salt.utils.files import salt.utils.path import...
saltstack/salt
salt/modules/virtualenv_mod.py
get_resource_path
python
def get_resource_path(venv, package=None, resource=None): ''' Return the path to a package resource installed inside a virtualenv .. versionadded:: 2015.5.0 venv Path to the virtualenv package Name of the package in which the resource re...
Return the path to a package resource installed inside a virtualenv .. versionadded:: 2015.5.0 venv Path to the virtualenv package Name of the package in which the resource resides .. versionadded:: 2016.3.0 resource Name of the resource of which the path is to be re...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virtualenv_mod.py#L381-L423
[ "def _verify_virtualenv(venv_path):\n bin_path = os.path.join(venv_path, 'bin/python')\n if not os.path.exists(bin_path):\n raise CommandExecutionError(\n 'Path \\'{0}\\' does not appear to be a virtualenv: bin/python not found.'.format(venv_path)\n )\n return bin_path\n", "def _...
# -*- coding: utf-8 -*- ''' Create virtualenv environments. .. versionadded:: 0.17.0 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import glob import shutil import logging import os import sys # Import salt libs import salt.utils.files import salt.utils.path import...
saltstack/salt
salt/cloud/clouds/libvirt.py
list_nodes
python
def list_nodes(call=None): ''' Return a list of the VMs id (str) image (str) size (str) state (str) private_ips (list) public_ips (list) ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes function must be called ' 'with -f or --f...
Return a list of the VMs id (str) image (str) size (str) state (str) private_ips (list) public_ips (list)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/libvirt.py#L162-L198
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def __get_conn(url):\n # This has only been tested on kvm and xen, it needs to be expanded to\n # support all vm layers supported by libvirt\n try:\n conn = libvirt.open(url)\n except Exception:\n raise SaltCloudExecutionFailu...
# -*- coding: utf-8 -*- ''' Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example...
saltstack/salt
salt/cloud/clouds/libvirt.py
list_nodes_select
python
def list_nodes_select(call=None): ''' Return a list of the VMs that are on the provider, with select fields ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes_select function must be called ' 'with -f or --function.' ) selection = __opts__.ge...
Return a list of the VMs that are on the provider, with select fields
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/libvirt.py#L215-L235
[ "def list_nodes_full(call=None):\n '''\n Because this module is not specific to any cloud providers, there will be\n no nodes to list.\n '''\n if call == 'action':\n raise SaltCloudSystemExit(\n 'The list_nodes_full function must be called '\n 'with -f or --function.'\n ...
# -*- coding: utf-8 -*- ''' Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example...
saltstack/salt
salt/cloud/clouds/libvirt.py
create
python
def create(vm_): ''' Provision a single machine ''' clone_strategy = vm_.get('clone_strategy') or 'full' if clone_strategy not in ('quick', 'full'): raise SaltCloudSystemExit("'clone_strategy' must be one of quick or full. Got '{0}'".format(clone_strategy)) ip_source = vm_.get('ip_sour...
Provision a single machine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/libvirt.py#L278-L471
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example...
saltstack/salt
salt/cloud/clouds/libvirt.py
do_cleanup
python
def do_cleanup(cleanup): ''' Clean up clone domain leftovers as much as possible. Extra robust clean up in order to deal with some small changes in libvirt behavior over time. Passed in volumes and domains are deleted, any errors are ignored. Used when cloning/provisioning a domain fails. :par...
Clean up clone domain leftovers as much as possible. Extra robust clean up in order to deal with some small changes in libvirt behavior over time. Passed in volumes and domains are deleted, any errors are ignored. Used when cloning/provisioning a domain fails. :param cleanup: list containing dictonari...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/libvirt.py#L474-L514
null
# -*- coding: utf-8 -*- ''' Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example...
saltstack/salt
salt/cloud/clouds/libvirt.py
destroy
python
def destroy(name, call=None): log.info("Attempting to delete instance %s", name) if call == 'function': raise SaltCloudSystemExit( 'The destroy action must be called with -d, --destroy, ' '-a or --action.' ) found = [] providers = __opts__.get('providers', {}) ...
This function irreversibly destroys a virtual machine on the cloud provider. Before doing so, it should fire an event on the Salt event bus. The tag for this event is `salt/cloud/<vm name>/destroying`. Once the virtual machine has been destroyed, another event is fired. The tag for that event is `salt/...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/libvirt.py#L517-L581
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def __get_conn(url):\n # This has only been tested on kvm and xen, it needs to be expanded to\n # support all vm layers supported by libvirt\n try:\n conn = libvirt.open(url)\n except Exception:\n raise SaltCloudExecutionFailu...
# -*- coding: utf-8 -*- ''' Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example...
saltstack/salt
salt/output/pprint_out.py
output
python
def output(data, **kwargs): # pylint: disable=unused-argument ''' Print out via pretty print ''' if isinstance(data, Exception): data = six.text_type(data) if 'output_indent' in __opts__ and __opts__['output_indent'] >= 0: return pprint.pformat(data, indent=__opts__['output_indent']...
Print out via pretty print
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/pprint_out.py#L34-L42
null
# -*- coding: utf-8 -*- ''' Python pretty-print (pprint) ============================ The python pretty-print system was once the default outputter. It simply passes the return data through to ``pprint.pformat`` and prints the results. Example output:: {'saltmine': {'foo': {'bar': 'baz', ...
saltstack/salt
salt/cloud/clouds/oneandone.py
get_size
python
def get_size(vm_): ''' Return the VM's size object ''' vm_size = config.get_cloud_config_value( 'fixed_instance_size', vm_, __opts__, default=None, search_global=False ) sizes = avail_sizes() if not vm_size: size = next((item for item in sizes if item['name'] == 'S')...
Return the VM's size object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L204-L224
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
get_image
python
def get_image(vm_): ''' Return the image object to use ''' vm_image = config.get_cloud_config_value('image', vm_, __opts__).encode( 'ascii', 'salt-cloud-force-ascii' ) images = avail_images() for key, value in six.iteritems(images): if vm_image and vm_image in (images[key]['...
Return the image object to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L227-L242
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n ...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
avail_locations
python
def avail_locations(conn=None, call=None): ''' List available locations/datacenters for 1&1 ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_locations function must be called with ' '-f or --function, or with the --list-locations option' ) datac...
List available locations/datacenters for 1&1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L245-L263
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
create_block_storage
python
def create_block_storage(kwargs=None, call=None): ''' Create a block storage ''' if call == 'action': raise SaltCloudSystemExit( 'The create_block_storage function must be called with ' '-f or --function' ) conn = get_conn() # Assemble the composite bloc...
Create a block storage
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L266-L283
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n", "def _...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_get_block_storage
python
def _get_block_storage(kwargs): ''' Construct a block storage instance from passed arguments ''' if kwargs is None: kwargs = {} block_storage_name = kwargs.get('name', None) block_storage_size = kwargs.get('size', None) block_storage_description = kwargs.get('description', None) ...
Construct a block storage instance from passed arguments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L286-L312
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_get_ssh_key
python
def _get_ssh_key(kwargs): ''' Construct an SshKey instance from passed arguments ''' ssh_key_name = kwargs.get('name', None) ssh_key_description = kwargs.get('description', None) public_key = kwargs.get('public_key', None) return SshKey( name=ssh_key_name, description=ssh_ke...
Construct an SshKey instance from passed arguments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L315-L327
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
create_ssh_key
python
def create_ssh_key(kwargs=None, call=None): ''' Create an ssh key ''' if call == 'action': raise SaltCloudSystemExit( 'The create_ssh_key function must be called with ' '-f or --function' ) conn = get_conn() # Assemble the composite SshKey object. ss...
Create an ssh key
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L330-L347
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n", "def _...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_get_firewall_policy
python
def _get_firewall_policy(kwargs): ''' Construct FirewallPolicy and FirewallPolicy instances from passed arguments ''' fp_name = kwargs.get('name', None) fp_description = kwargs.get('description', None) firewallPolicy = FirewallPolicy( name=fp_name, description=fp_description ...
Construct FirewallPolicy and FirewallPolicy instances from passed arguments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L350-L382
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
create_firewall_policy
python
def create_firewall_policy(kwargs=None, call=None): ''' Create a firewall policy ''' if call == 'action': raise SaltCloudSystemExit( 'The create_firewall_policy function must be called with ' '-f or --function' ) conn = get_conn() # Assemble the composit...
Create a firewall policy
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L385-L405
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n", "def _...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
avail_images
python
def avail_images(conn=None, call=None): ''' Return a list of the server appliances that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) ...
Return a list of the server appliances that are on the provider
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L408-L426
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
avail_baremetal_images
python
def avail_baremetal_images(conn=None, call=None): ''' Return a list of the baremetal server appliances that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_baremetal_images function must be called with ' '-f or --function' ) ...
Return a list of the baremetal server appliances that are on the provider
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L429-L447
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
avail_sizes
python
def avail_sizes(call=None): ''' Return a dict of all available VM sizes 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 option' ...
Return a dict of all available VM sizes on the cloud provider with relevant data.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L450-L465
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
baremetal_models
python
def baremetal_models(call=None): ''' Return a dict of all available baremetal models with relevant data. ''' if call == 'action': raise SaltCloudSystemExit( 'The baremetal_models function must be called with ' '-f or --function' ) conn = get_conn() bmode...
Return a dict of all available baremetal models with relevant data.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L468-L482
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
list_nodes
python
def list_nodes(conn=None, call=None): ''' Return a list of 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() ret = {} nodes = ...
Return a list of VMs that are on the provider
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L499-L539
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
list_nodes_full
python
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: ...
Return a list of the VMs that are on the provider, with all fields
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L542-L561
[ "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n api_token=config.get_cloud_config_value(\n 'api_token',\n get_configured_provider(),\n __opts__,\n search_global=False\n )\n )\n" ]
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_get_server
python
def _get_server(vm_): ''' Construct server instance from cloud profile config ''' description = config.get_cloud_config_value( 'description', vm_, __opts__, default=None, search_global=False ) ssh_key = load_public_key(vm_) server_type = config.get_cloud_config_value( ...
Construct server instance from cloud profile config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L596-L716
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_get_hdds
python
def _get_hdds(vm_): ''' Construct VM hdds from cloud profile config ''' _hdds = config.get_cloud_config_value( 'hdds', vm_, __opts__, default=None, search_global=False ) hdds = [] for hdd in _hdds: hdds.append( Hdd( size=hdd['size'], ...
Construct VM hdds from cloud profile config
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L719-L738
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
create
python
def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if (vm_['profile'] and config.is_profile_configured(__opts__, (__active_provider_name__ or ...
Create a single VM from a data dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L741-L870
[ "def destroy(name, call=None):\n '''\n destroy a server by name\n\n :param name: name given to the server\n :param call: call value in this case is 'action'\n :return: array of booleans , true if successfully stopped and true if\n successfully removed\n\n CLI Example:\n\n .. code-bl...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
destroy
python
def destroy(name, call=None): ''' destroy a server by name :param name: name given to the server :param call: call value in this case is 'action' :return: array of booleans , true if successfully stopped and true if successfully removed CLI Example: .. code-block:: bash ...
destroy a server by name :param name: name given to the server :param call: call value in this case is 'action' :return: array of booleans , true if successfully stopped and true if successfully removed CLI Example: .. code-block:: bash salt-cloud -d vm_name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L873-L925
[ "def get_node(conn, name):\n '''\n Return a node for the named VM\n '''\n for node in conn.list_servers(per_page=1000):\n if node['name'] == name:\n return node\n", "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n ...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
reboot
python
def reboot(name, call=None): ''' reboot a server by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name ''' conn = get_conn() node = get_...
reboot a server by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L928-L946
[ "def get_node(conn, name):\n '''\n Return a node for the named VM\n '''\n for node in conn.list_servers(per_page=1000):\n if node['name'] == name:\n return node\n", "def get_conn():\n '''\n Return a conn object for the passed VM data\n '''\n return OneAndOneService(\n ...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
get_node
python
def get_node(conn, name): ''' Return a node for the named VM ''' for node in conn.list_servers(per_page=1000): if node['name'] == name: return node
Return a node for the named VM
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L992-L998
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
load_public_key
python
def load_public_key(vm_): ''' Load the public key file if exists. ''' public_key_filename = config.get_cloud_config_value( 'ssh_public_key', vm_, __opts__, search_global=False, default=None ) if public_key_filename is not None: public_key_filename = os.path.expanduser(public_key_...
Load the public key file if exists.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L1020-L1039
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/cloud/clouds/oneandone.py
_wait_for_completion
python
def _wait_for_completion(conn, wait_timeout, server_id): ''' Poll request status until resource is provisioned. ''' wait_timeout = time.time() + wait_timeout while wait_timeout > time.time(): time.sleep(5) server = conn.get_server(server_id) server_state = server['status']['...
Poll request status until resource is provisioned.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/oneandone.py#L1052-L1077
null
# -*- coding: utf-8 -*- ''' 1&1 Cloud Server Module ======================= The 1&1 SaltStack cloud module allows a 1&1 server to be automatically deployed and bootstrapped with Salt. It also has functions to create block storages and ssh keys. :depends: 1and1 >= 1.2.0 The module requires the 1&1 api_token to be pro...
saltstack/salt
salt/states/bigip.py
_load_result
python
def _load_result(response, ret): ''' format the results of listing functions ''' #were we able to connect? if response['code'] is None: ret['comment'] = response['content'] #forbidden? elif response['code'] == 401: ret['comment'] = '401 Forbidden: Authentication required!' ...
format the results of listing functions
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L26-L50
null
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
_strip_key
python
def _strip_key(dictionary, keyword): ''' look for a certain key within a dictionary and nullify ti's contents, check within nested dictionaries and lists as well. Certain attributes such as "generation" will change even when there were no changes made to the entity. ''' for key, value in six.i...
look for a certain key within a dictionary and nullify ti's contents, check within nested dictionaries and lists as well. Certain attributes such as "generation" will change even when there were no changes made to the entity.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L53-L70
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _strip_key(dictionary, keyword):\n '''\n look for a certain key within a dictionary and nullify ti's contents, check within nested\n dictionaries and lists as well. Certain attributes such as \"generation\" will change even\n when there ...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
_check_for_changes
python
def _check_for_changes(entity_type, ret, existing, modified): ''' take an existing entity and a modified entity and check for changes. ''' ret['result'] = True #were there any changes? generation always changes, remove it. if isinstance(existing, dict) and isinstance(modified, dict): ...
take an existing entity and a modified entity and check for changes.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L73-L106
null
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
create_node
python
def create_node(hostname, username, password, name, address): ''' Create a new node if it does not already exist. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node to cr...
Create a new node if it does not already exist. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node to create address The address of the node
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L165-L215
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
manage_node
python
def manage_node(hostname, username, password, name, address, connection_limit=None, description=None, dynamic_ratio=None, logging=None, monitor=None, rate_limit=None, ratio=None, session=None,...
Manages a node of a given bigip device. If the node does not exist it will be created, otherwise, only the properties which are different than the existing will be updated. hostname The host/address of the bigip device username The iControl REST username password The iControl R...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L218-L369
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
modify_node
python
def modify_node(hostname, username, password, name, connection_limit=None, description=None, dynamic_ratio=None, logging=None, monitor=None, rate_limit=None, ratio=None, session=None, ...
Modify an existing node. Only a node which already exists will be modified and only the parameters specified will be enforced. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the n...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L372-L467
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
create_pool
python
def create_pool(hostname, username, password, name, members=None, allow_nat=None, allow_snat=None, description=None, gateway_failsafe_device=None, ignore_persisted_weight=None, ip_tos_to_client=None, ip_tos_t...
Create a new node if it does not already exist. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to create members List of members to be added to the pool allow...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L554-L731
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
manage_pool
python
def manage_pool(hostname, username, password, name, allow_nat=None, allow_snat=None, description=None, gateway_failsafe_device=None, ignore_persisted_weight=None, ip_tos_to_client=None, ip_tos_to_server=None,...
Create a new pool if it does not already exist. Pool members are managed separately. Only the parameters specified are enforced. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L734-L951
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
delete_pool
python
def delete_pool(hostname, username, password, name): ''' Delete an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool which will be deleted ''' re...
Delete an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool which will be deleted
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1135-L1187
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
manage_pool_members
python
def manage_pool_members(hostname, username, password, name, members): ''' Manage the members of an existing pool. This function replaces all current pool members. Only the parameters specified are enforced. hostname The host/address of the bigip device username The iControl REST us...
Manage the members of an existing pool. This function replaces all current pool members. Only the parameters specified are enforced. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name o...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1190-L1266
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
add_pool_member
python
def add_pool_member(hostname, username, password, name, member): ''' A function to connect to a bigip device and add a new member to an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password na...
A function to connect to a bigip device and add a new member to an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to modify member The member to ad...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1269-L1355
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
modify_pool_member
python
def modify_pool_member(hostname, username, password, name, member, connection_limit=None, description=None, dynamic_ratio=None, inherit_profile=None, logging=None, monitor=None, ...
A function to connect to a bigip device and modify a member of an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to modify member The member modify...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1358-L1494
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
delete_pool_member
python
def delete_pool_member(hostname, username, password, name, member): ''' Delete an existing pool member. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to be modified ...
Delete an existing pool member. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to be modified member The name of the member to delete from the pool
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1497-L1561
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
list_virtual
python
def list_virtual(hostname, username, password, name): ''' A function to list a specific virtual. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the virtual to list ''' ...
A function to list a specific virtual. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the virtual to list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1564-L1590
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
manage_virtual
python
def manage_virtual(hostname, username, password, name, destination, pool=None, address_status=None, auto_lasthop=None, bwc_policy=None, cmp_enabled=None, connection_limit=None, dhcp_relay...
Manage a virtual server. If a virtual does not exists it will be created, otherwise only the parameters specified will be enforced. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L1851-L2169
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
modify_virtual
python
def modify_virtual(hostname, username, password, name, destination, pool=None, address_status=None, auto_lasthop=None, bwc_policy=None, cmp_enabled=None, connection_limit=None, dhcp_relay...
Modify an virtual server. modify an existing virtual. Only parameters specified will be enforced. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the virtual to create destinatio...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L2172-L2436
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
create_monitor
python
def create_monitor(hostname, username, password, monitor_type, name, **kwargs): ''' A function to connect to a bigip device and create a monitor. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password monitor...
A function to connect to a bigip device and create a monitor. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password monitor_type The type of monitor to create name The name of the monitor to crea...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L2524-L2587
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] =...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/states/bigip.py
create_profile
python
def create_profile(hostname, username, password, profile_type, name, **kwargs): r''' A function to connect to a bigip device and create a profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profil...
r''' A function to connect to a bigip device and create a profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile_type The type of profile to create name The name of the profil...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bigip.py#L2823-L2885
[ "def _load_result(response, ret):\n '''\n format the results of listing functions\n '''\n\n #were we able to connect?\n if response['code'] is None:\n ret['comment'] = response['content']\n #forbidden?\n elif response['code'] == 401:\n ret['comment'] = '401 Forbidden: Authenticati...
# -*- coding: utf-8 -*- ''' A state module designed to enforce load-balancing configurations for F5 Big-IP entities. :maturity: develop :platform: f5_bigip_11.6 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt libs import salt.utils.json...
saltstack/salt
salt/cloud/clouds/scaleway.py
avail_images
python
def avail_images(call=None): ''' Return a list of the images that are on the provider. ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) items = query(method...
Return a list of the images that are on the provider.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L72-L88
[ "def query(method='servers', server_id=None, command=None, args=None,\n http_method='GET', root='api_root'):\n ''' Make a call to the Scaleway API.\n '''\n\n if root == 'api_root':\n default_url = 'https://cp-par1.scaleway.com'\n else:\n default_url = 'https://api-marketplace.scal...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
list_nodes
python
def list_nodes(call=None): ''' Return a list of the BareMetal servers that are on the provider. ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes function must be called with -f or --function.' ) items = query(method='servers') ret = {} for node in...
Return a list of the BareMetal servers that are on the provider.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L91-L124
[ "def query(method='servers', server_id=None, command=None, args=None,\n http_method='GET', root='api_root'):\n ''' Make a call to the Scaleway API.\n '''\n\n if root == 'api_root':\n default_url = 'https://cp-par1.scaleway.com'\n else:\n default_url = 'https://api-marketplace.scal...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
list_nodes_full
python
def list_nodes_full(call=None): ''' Return a list of the BareMetal servers that are on the provider. ''' if call == 'action': raise SaltCloudSystemExit( 'list_nodes_full must be called with -f or --function' ) items = query(method='servers') # For each server, iterate o...
Return a list of the BareMetal servers that are on the provider.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L127-L144
[ "def query(method='servers', server_id=None, command=None, args=None,\n http_method='GET', root='api_root'):\n ''' Make a call to the Scaleway API.\n '''\n\n if root == 'api_root':\n default_url = 'https://cp-par1.scaleway.com'\n else:\n default_url = 'https://api-marketplace.scal...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
get_image
python
def get_image(server_): ''' Return the image object to use. ''' images = avail_images() server_image = six.text_type(config.get_cloud_config_value( 'image', server_, __opts__, search_global=False )) for image in images: if server_image in (images[image]['name'], images[image]['id...
Return the image object to use.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L156-L168
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
create_node
python
def create_node(args): ''' Create a node. ''' node = query(method='servers', args=args, http_method='POST') action = query( method='servers', server_id=node['server']['id'], command='action', args={'action': 'poweron'}, http_method='POST' ) return node
Create a node.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L171-L183
[ "def query(method='servers', server_id=None, command=None, args=None,\n http_method='GET', root='api_root'):\n ''' Make a call to the Scaleway API.\n '''\n\n if root == 'api_root':\n default_url = 'https://cp-par1.scaleway.com'\n else:\n default_url = 'https://api-marketplace.scal...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
create
python
def create(server_): ''' Create a single BareMetal server from a data dict. ''' try: # Check for required profile parameters before sending any API calls. if server_['profile'] and config.is_profile_configured(__opts__, __act...
Create a single BareMetal server from a data dict.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L186-L313
[ "def destroy(name, call=None):\n ''' Destroy a node. Will check termination protection and warn if enabled.\n\n CLI Example:\n .. code-block:: bash\n\n salt-cloud --destroy mymachine\n '''\n if call == 'function':\n raise SaltCloudSystemExit(\n 'The destroy action must be cal...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
query
python
def query(method='servers', server_id=None, command=None, args=None, http_method='GET', root='api_root'): ''' Make a call to the Scaleway API. ''' if root == 'api_root': default_url = 'https://cp-par1.scaleway.com' else: default_url = 'https://api-marketplace.scaleway.com' ...
Make a call to the Scaleway API.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L316-L376
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/cloud/clouds/scaleway.py
script
python
def script(server_): ''' Return the script deployment object. ''' return salt.utils.cloud.os_script( config.get_cloud_config_value('script', server_, __opts__), server_, __opts__, salt.utils.cloud.salt_config_to_yaml( salt.utils.cloud.minion_config(__opts__, serve...
Return the script deployment object.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/scaleway.py#L379-L389
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' Scaleway Cloud Module ===================== .. versionadded:: 2015.8.0 The Scaleway cloud module is used to interact with your Scaleway BareMetal Servers. Use of this module only requires the ``api_key`` parameter to be set. Set up the cloud configuration at ``/etc/salt/cloud.providers`` ...
saltstack/salt
salt/states/ssh_auth.py
present
python
def present( name, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None, **kwargs): ''' Verifies that the specified SSH key is present for the specified user name T...
Verifies that the specified SSH key is present for the specified user name The SSH key to manage user The user who owns the SSH authorized keys file to modify enc Defines what type of key is being used; can be ed25519, ecdsa, ssh-rsa or ssh-dss comment The com...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_auth.py#L215-L389
[ "def _present_test(user, name, enc, comment, options, source, config, fingerprint_hash_type):\n '''\n Run checks for \"present\"\n '''\n result = None\n if source:\n keys = __salt__['ssh.check_key_file'](\n user,\n source,\n config,\n ...
# -*- coding: utf-8 -*- ''' Control of entries in SSH authorized_key files ============================================== The information stored in a user's SSH authorized key file can be easily controlled via the ssh_auth state. Defaults can be set by the enc, options, and comment keys. These defaults can be overridd...
saltstack/salt
salt/states/ssh_auth.py
absent
python
def absent(name, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None): ''' Verifies that the specified SSH key is absent name The SSH key to manage user ...
Verifies that the specified SSH key is absent name The SSH key to manage user The user who owns the SSH authorized keys file to modify enc Defines what type of key is being used; can be ed25519, ecdsa, ssh-rsa or ssh-dss comment The comment to be placed with t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_auth.py#L392-L509
[ "def _absent_test(user, name, enc, comment, options, source, config, fingerprint_hash_type):\n '''\n Run checks for \"absent\"\n '''\n result = None\n if source:\n keys = __salt__['ssh.check_key_file'](\n user,\n source,\n config,\n s...
# -*- coding: utf-8 -*- ''' Control of entries in SSH authorized_key files ============================================== The information stored in a user's SSH authorized key file can be easily controlled via the ssh_auth state. Defaults can be set by the enc, options, and comment keys. These defaults can be overridd...
saltstack/salt
salt/states/ssh_auth.py
manage
python
def manage( name, ssh_keys, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None, **kwargs): ''' .. versionadded:: Neon Ensures that only the specified ssh_keys are...
.. versionadded:: Neon Ensures that only the specified ssh_keys are present for the specified user ssh_keys The SSH key to manage user The user who owns the SSH authorized keys file to modify enc Defines what type of key is being used; can be ed25519, ecdsa, ssh-rsa o...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_auth.py#L512-L605
[ "def present(\n name,\n user,\n enc='ssh-rsa',\n comment='',\n source='',\n options=None,\n config='.ssh/authorized_keys',\n fingerprint_hash_type=None,\n **kwargs):\n '''\n Verifies that the specified SSH key is present for the specified user\n\n...
# -*- coding: utf-8 -*- ''' Control of entries in SSH authorized_key files ============================================== The information stored in a user's SSH authorized key file can be easily controlled via the ssh_auth state. Defaults can be set by the enc, options, and comment keys. These defaults can be overridd...
saltstack/salt
salt/runners/smartos_vmadm.py
_action
python
def _action(action='get', search=None, one=True, force=False): ''' Multi action helper for start, stop, get, ... ''' vms = {} matched_vms = [] client = salt.client.get_local_client(__opts__['conf_file']) ## lookup vms try: vmadm_args = {} vmadm_args['order'] = 'uuid,alia...
Multi action helper for start, stop, get, ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/smartos_vmadm.py#L36-L133
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the conf...
# -*- coding: utf-8 -*- ''' Runner for SmartOS minions control vmadm ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.client from salt.exceptions import SaltClientError from salt.utils.odict import OrderedDict # Import 3rd party libs from...
saltstack/salt
salt/runners/smartos_vmadm.py
nodes
python
def nodes(verbose=False): ''' List all compute nodes verbose : boolean print additional information about the node e.g. platform version, hvm capable, ... CLI Example: .. code-block:: bash salt-run vmadm.nodes salt-run vmadm.nodes verbose=True ''' ret = {}...
List all compute nodes verbose : boolean print additional information about the node e.g. platform version, hvm capable, ... CLI Example: .. code-block:: bash salt-run vmadm.nodes salt-run vmadm.nodes verbose=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/smartos_vmadm.py#L136-L187
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the conf...
# -*- coding: utf-8 -*- ''' Runner for SmartOS minions control vmadm ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.client from salt.exceptions import SaltClientError from salt.utils.odict import OrderedDict # Import 3rd party libs from...
saltstack/salt
salt/runners/smartos_vmadm.py
list_vms
python
def list_vms(search=None, verbose=False): ''' List all vms search : string filter vms, see the execution module verbose : boolean print additional information about the vm CLI Example: .. code-block:: bash salt-run vmadm.list salt-run vmadm.list search='type=K...
List all vms search : string filter vms, see the execution module verbose : boolean print additional information about the vm CLI Example: .. code-block:: bash salt-run vmadm.list salt-run vmadm.list search='type=KVM' salt-run vmadm.list verbose=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/smartos_vmadm.py#L190-L247
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_local_client(\n c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),\n mopts=None,\n skip_perm_errors=False,\n io_loop=None,\n auto_reconnect=False):\n '''\n .. versionadded:: 2014.7.0\n\n Read in the conf...
# -*- coding: utf-8 -*- ''' Runner for SmartOS minions control vmadm ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.client from salt.exceptions import SaltClientError from salt.utils.odict import OrderedDict # Import 3rd party libs from...
saltstack/salt
salt/runners/smartos_vmadm.py
reboot
python
def reboot(search, one=True, force=False): ''' Reboot one or more vms search : string filter vms, see the execution module. one : boolean reboot only one vm force : boolean force reboot, faster but no graceful shutdown .. note:: If the search parameter does not ...
Reboot one or more vms search : string filter vms, see the execution module. one : boolean reboot only one vm force : boolean force reboot, faster but no graceful shutdown .. note:: If the search parameter does not contain an equal (=) symbol it will be assumed ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/smartos_vmadm.py#L298-L321
[ "def _action(action='get', search=None, one=True, force=False):\n '''\n Multi action helper for start, stop, get, ...\n '''\n vms = {}\n matched_vms = []\n client = salt.client.get_local_client(__opts__['conf_file'])\n\n ## lookup vms\n try:\n vmadm_args = {}\n vmadm_args['orde...
# -*- coding: utf-8 -*- ''' Runner for SmartOS minions control vmadm ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals # Import salt libs import salt.client from salt.exceptions import SaltClientError from salt.utils.odict import OrderedDict # Import 3rd party libs from...
saltstack/salt
salt/cloud/clouds/ec2.py
_xml_to_dict
python
def _xml_to_dict(xmltree): ''' Convert an XML tree into a dict ''' if sys.version_info < (2, 7): children_len = len(xmltree.getchildren()) else: children_len = len(xmltree) if children_len < 1: name = xmltree.tag if '}' in name: comps = name.split('}'...
Convert an XML tree into a dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L225-L263
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
optimize_providers
python
def optimize_providers(providers): ''' Return an optimized list of providers. We want to reduce the duplication of querying the same region. If a provider is using the same credentials for the same region the same data will be returned for each provider, thus causing un-wanted duplicate da...
Return an optimized list of providers. We want to reduce the duplication of querying the same region. If a provider is using the same credentials for the same region the same data will be returned for each provider, thus causing un-wanted duplicate data and API calls to EC2.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L266-L302
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_wait_for_spot_instance
python
def _wait_for_spot_instance(update_callback, update_args=None, update_kwargs=None, timeout=10 * 60, interval=30, interval_multiplier=1, max_failures=10)...
Helper function that waits for a spot instance request to become active for a specific maximum amount of time. :param update_callback: callback function which queries the cloud provider for spot instance request. It must return None if the required data, ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L476-L548
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...