_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253900 | Resource.callback | validation | def callback(self, pk=None, host_config_key='', extra_vars=None):
"""Contact Tower and request a configuration update using this job template.
=====API DOCS=====
Contact Tower and request a provisioning callback using this job template.
:param pk: Primary key of the job template to run... | python | {
"resource": ""
} |
q253901 | jt_aggregate | validation | def jt_aggregate(func, is_create=False, has_pk=False):
"""Decorator to aggregate unified_jt-related fields.
Args:
func: The CURD method to be decorated.
is_create: Boolean flag showing whether this method is create.
has_pk: Boolean flag showing whether this method uses pk as argument.
... | python | {
"resource": ""
} |
q253902 | Resource.lookup_stdout | validation | def lookup_stdout(self, pk=None, start_line=None, end_line=None,
full=True):
"""
Internal method that lies to our `monitor` method by returning
a scorecard for the workflow job where the standard out
would have been expected.
"""
uj_res = get_resourc... | python | {
"resource": ""
} |
q253903 | Resource.launch | validation | def launch(self, workflow_job_template=None, monitor=False, wait=False,
timeout=None, extra_vars=None, **kwargs):
"""Launch a new workflow job based on a workflow job template.
Creates a new workflow job in Ansible Tower, starts it, and
returns back an ID in order for its status ... | python | {
"resource": ""
} |
q253904 | ActionSubcommand.parse_args | validation | def parse_args(self, ctx, args):
"""Parse arguments sent to this command.
The code for this method is taken from MultiCommand:
https://github.com/mitsuhiko/click/blob/master/click/core.py
It is Copyright (c) 2014 by Armin Ronacher.
See the license:
https://github.com/mi... | python | {
"resource": ""
} |
q253905 | ActionSubcommand.format_options | validation | def format_options(self, ctx, formatter):
"""Monkey-patch click's format_options method to support option categorization.
"""
field_opts = []
global_opts = []
local_opts = []
other_opts = []
for param in self.params:
if param.name in SETTINGS_PARMS:
... | python | {
"resource": ""
} |
q253906 | Resource.get | validation | def get(self, pk):
"""Return one and exactly one object
=====API DOCS=====
Return one and exactly one Tower setting.
:param pk: Primary key of the Tower setting to retrieve
:type pk: int
:returns: loaded JSON of the retrieved Tower setting object.
:rtype: dict
... | python | {
"resource": ""
} |
q253907 | BaseResource._convert_pagenum | validation | def _convert_pagenum(self, kwargs):
"""
Convert next and previous from URLs to integers
"""
for key in ('next', 'previous'):
if not kwargs.get(key):
continue
match = re.search(r'page=(?P<num>[\d]+)', kwargs[key])
| python | {
"resource": ""
} |
q253908 | BaseResource.delete | validation | def delete(self, pk=None, fail_on_missing=False, **kwargs):
"""Remove the given object.
If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise,
a success with no change is reported.
=====API DOCS=====
Remove the given object.
... | python | {
"resource": ""
} |
q253909 | BaseResource.get | validation | def get(self, pk=None, **kwargs):
"""Return one and exactly one object.
Lookups may be through a primary key, specified as a positional argument, and/or through filters specified
through keyword arguments.
If the number of results does not equal one, raise an exception.
=====A... | python | {
"resource": ""
} |
q253910 | BaseResource._disassoc | validation | def _disassoc(self, url_fragment, me, other):
"""Disassociate the `other` record from the `me` record."""
# Get the endpoint for foreign records within this object.
url = self.endpoint + '%d/%s/' % (me, url_fragment)
# Attempt to determine whether the other record already is absent, fo... | python | {
"resource": ""
} |
q253911 | Resource.copy | validation | def copy(self, pk=None, new_name=None, **kwargs):
"""Copy an object.
Only the ID is used for the lookup. All provided fields are used to override the old data from the
copied resource.
=====API DOCS=====
Copy an object.
:param pk: Primary key of the resource object to ... | python | {
"resource": ""
} |
q253912 | MonitorableResource.last_job_data | validation | def last_job_data(self, pk=None, **kwargs):
"""
Internal utility function for Unified Job Templates. Returns data about the last job run off of that UJT
"""
ujt = self.get(pk, include_debug_header=True, **kwargs)
# Determine the appropriate inventory source update.
if 'c... | python | {
"resource": ""
} |
q253913 | MonitorableResource.lookup_stdout | validation | def lookup_stdout(self, pk=None, start_line=None, end_line=None, full=True):
"""
Internal utility function to return standard out. Requires the pk of a unified job.
"""
stdout_url = '%s%s/stdout/' % (self.unified_job_type, pk)
payload = {'format': 'json', 'content_encoding': 'bas... | python | {
"resource": ""
} |
q253914 | MonitorableResource.stdout | validation | def stdout(self, pk, start_line=None, end_line=None, outfile=sys.stdout, **kwargs):
"""
Print out the standard out of a unified job to the command line or output file.
For Projects, print the standard out of most recent update.
For Inventory Sources, print standard out of most recent syn... | python | {
"resource": ""
} |
q253915 | MonitorableResource.monitor | validation | def monitor(self, pk, parent_pk=None, timeout=None, interval=0.5, outfile=sys.stdout, **kwargs):
"""
Stream the standard output from a job, project update, or inventory udpate.
=====API DOCS=====
Stream the standard output from a job run to stdout.
:param pk: Primary key of the... | python | {
"resource": ""
} |
q253916 | ExeResource.status | validation | def status(self, pk=None, detail=False, **kwargs):
"""Print the current job status. This is used to check a running job. You can look up the job with
the same parameters used for a get request.
=====API DOCS=====
Retrieve the current job status.
:param pk: Primary key of the re... | python | {
"resource": ""
} |
q253917 | ExeResource.cancel | validation | def cancel(self, pk=None, fail_if_not_running=False, **kwargs):
"""Cancel a currently running job.
Fails with a non-zero exit status if the job cannot be canceled.
You must provide either a pk or parameters in the job's identity.
=====API DOCS=====
Cancel a currently running jo... | python | {
"resource": ""
} |
q253918 | ExeResource.relaunch | validation | def relaunch(self, pk=None, **kwargs):
"""Relaunch a stopped job.
Fails with a non-zero exit status if the job cannot be relaunched.
You must provide either a pk or parameters in the job's identity.
=====API DOCS=====
Relaunch a stopped job resource.
:param pk: Primary... | python | {
"resource": ""
} |
q253919 | Resource.batch_update | validation | def batch_update(self, pk=None, **kwargs):
"""Update all related inventory sources of the given inventory.
Note global option --format is not available here, as the output would always be JSON-formatted.
=====API DOCS=====
Update all related inventory sources of the given inventory.
... | python | {
"resource": ""
} |
q253920 | Resource.read | validation | def read(self, *args, **kwargs):
'''
Do extra processing so we can display the actor field as
a top-level field
'''
if 'actor' in kwargs:
kwargs['actor'] = kwargs.pop('actor')
r = super(Resource, self).read(*args, **kwargs)
if 'results' in | python | {
"resource": ""
} |
q253921 | log | validation | def log(s, header='', file=sys.stderr, nl=1, **kwargs):
"""Log the given output to stderr if and only if we are in
verbose mode.
If we are not in verbose mode, this is a no-op.
"""
# Sanity check: If we are not in verbose mode, this is a no-op.
if not settings.verbose:
return
# Con... | python | {
"resource": ""
} |
q253922 | ManyToManyField.configure_model | validation | def configure_model(self, attrs, field_name):
'''
Hook for ResourceMeta class to call when initializing model class.
Saves fields obtained from resource class backlinks
'''
| python | {
"resource": ""
} |
q253923 | ManyToManyField._produce_raw_method | validation | def _produce_raw_method(self):
'''
Returns a callable which becomes the associate or disassociate
method for the related field.
Method can be overridden to add additional functionality, but
`_produce_method` may also need to be subclassed to | python | {
"resource": ""
} |
q253924 | Resource.create | validation | def create(self, fail_on_found=False, force_on_exists=False, **kwargs):
"""Create a new label.
There are two types of label creation: isolatedly creating a new label and creating a new label under
a job template. Here the two types are discriminated by whether to provide --job-template option.
... | python | {
"resource": ""
} |
q253925 | version | validation | def version():
"""Display full version information."""
# Print out the current version of Tower CLI.
click.echo('Tower CLI %s' % __version__)
# Print out the current API version of the current code base.
click.echo('API %s' % CUR_API_VERSION)
# Attempt to connect to the Ansible Tower server.
... | python | {
"resource": ""
} |
q253926 | _echo_setting | validation | def _echo_setting(key):
"""Echo a setting to the CLI."""
value = getattr(settings, key)
secho('%s: ' % key, fg='magenta', bold=True, nl=False)
secho(
six.text_type(value),
| python | {
"resource": ""
} |
q253927 | config | validation | def config(key=None, value=None, scope='user', global_=False, unset=False):
"""Read or write tower-cli configuration.
`tower config` saves the given setting to the appropriate Tower CLI;
either the user's ~/.tower_cli.cfg file, or the /etc/tower/tower_cli.cfg
file if --global is used.
Writing to /... | python | {
"resource": ""
} |
q253928 | login | validation | def login(username, password, scope, client_id, client_secret, verbose):
"""
Retrieves and stores an OAuth2 personal auth token.
"""
if not supports_oauth():
raise exc.TowerCLIError(
'This version of Tower does not support OAuth2.0. Set credentials using tower-cli config.'
)
... | python | {
"resource": ""
} |
q253929 | receive | validation | def receive(organization=None, user=None, team=None, credential_type=None, credential=None,
notification_template=None, inventory_script=None, inventory=None, project=None, job_template=None,
workflow=None, all=None):
"""Export assets from Tower.
'tower receive' exports one or more asse... | python | {
"resource": ""
} |
q253930 | send | validation | def send(source=None, prevent=None, exclude=None, secret_management='default', no_color=False):
"""Import assets into Tower.
'tower send' imports one or more assets into a Tower instance
The import can take either JSON or YAML.
Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from f... | python | {
"resource": ""
} |
q253931 | empty | validation | def empty(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None,
inventory_script=None, inventory=None, project=None, job_template=None, workflow=None,
all=None, no_color=False):
"""Empties assets from Tower.
'tower empty' removes all ass... | python | {
"resource": ""
} |
q253932 | parse_requirements | validation | def parse_requirements(filename):
"""Parse out a list of requirements from the given requirements
requirements file.
"""
reqs = []
version_spec_in_play = None
# Iterate over each line in the requirements file.
for line in open(filename, 'r').read().strip().split('\n'):
# Sanity chec... | python | {
"resource": ""
} |
q253933 | Resource.modify | validation | def modify(self, pk=None, create_on_missing=False, **kwargs):
"""Modify an already existing.
To edit the project's organizations, see help for organizations.
Fields in the resource's `identity` tuple can be used in lieu of a
primary key for a lookup; in such a case, only other fields a... | python | {
"resource": ""
} |
q253934 | Resource.update | validation | def update(self, pk=None, create_on_missing=False, monitor=False,
wait=False, timeout=None, name=None, organization=None):
"""Trigger a project update job within Ansible Tower.
Only meaningful on non-manual projects.
=====API DOCS=====
Update the given project.
:... | python | {
"resource": ""
} |
q253935 | Resource.status | validation | def status(self, pk=None, detail=False, **kwargs):
"""Print the status of the most recent update.
=====API DOCS=====
Print the status of the most recent update.
:param pk: Primary key of the resource to retrieve status from.
:type pk: int
:param detail: Flag that if set... | python | {
"resource": ""
} |
q253936 | Variables.convert | validation | def convert(self, value, param, ctx):
"""Return file content if file, else, return value as-is
"""
# Protect against corner cases of invalid inputs
if not isinstance(value, str):
return value
if isinstance(value, six.binary_type):
value = value.decode('UTF... | python | {
"resource": ""
} |
q253937 | MappedChoice.convert | validation | def convert(self, value, param, ctx):
"""Match against the appropriate choice value using the superclass
implementation, and then return the actual choice.
"""
| python | {
"resource": ""
} |
q253938 | Related.convert | validation | def convert(self, value, param, ctx):
"""Return the appropriate integer value. If a non-integer is
provided, attempt a name-based lookup and return the primary key.
"""
resource = tower_cli.get_resource(self.resource_name)
# Ensure that None is passed through without trying to
... | python | {
"resource": ""
} |
q253939 | Resource._parent_filter | validation | def _parent_filter(self, parent, relationship, **kwargs):
"""
Returns filtering parameters to limit a search to the children
of a particular node by a particular relationship.
"""
if parent is None or relationship is None:
return {}
parent_filter_kwargs = {}
... | python | {
"resource": ""
} |
q253940 | Resource.associate_success_node | validation | def associate_success_node(self, parent, child=None, **kwargs):
"""Add a node to run on success.
=====API DOCS=====
Add a node to run on success.
:param parent: Primary key of parent node to associate success node to.
:type parent: int
:param child: Primary key of child... | python | {
"resource": ""
} |
q253941 | Resource.disassociate_success_node | validation | def disassociate_success_node(self, parent, child):
"""Remove success node.
The resulatant 2 nodes will both become root nodes.
=====API DOCS=====
Remove success node.
:param parent: Primary key of parent node to disassociate success node from.
:type parent: int
... | python | {
"resource": ""
} |
q253942 | Resource.associate_failure_node | validation | def associate_failure_node(self, parent, child=None, **kwargs):
"""Add a node to run on failure.
=====API DOCS=====
Add a node to run on failure.
:param parent: Primary key of parent node to associate failure node to.
:type parent: int
:param child: Primary key of child... | python | {
"resource": ""
} |
q253943 | Resource.disassociate_failure_node | validation | def disassociate_failure_node(self, parent, child):
"""Remove a failure node link.
The resulatant 2 nodes will both become root nodes.
=====API DOCS=====
Remove a failure node link.
:param parent: Primary key of parent node to disassociate failure node from.
:type paren... | python | {
"resource": ""
} |
q253944 | Resource.associate_always_node | validation | def associate_always_node(self, parent, child=None, **kwargs):
"""Add a node to always run after the parent is finished.
=====API DOCS=====
Add a node to always run after the parent is finished.
:param parent: Primary key of parent node to associate always node to.
| python | {
"resource": ""
} |
q253945 | Resource.disassociate_always_node | validation | def disassociate_always_node(self, parent, child):
"""Remove an always node link.
The resultant 2 nodes will both become root nodes.
=====API DOCS=====
Remove an always node link.
:param parent: Primary key of parent node to disassociate always node from.
:type parent: ... | python | {
"resource": ""
} |
q253946 | Resource.data_endpoint | validation | def data_endpoint(cls, in_data, ignore=[]):
"""
Converts a set of CLI input arguments, `in_data`, into
request data and an endpoint that can be used to look
up a role or list of roles.
Also changes the format of `type` in data to what the server
expects for the role mode... | python | {
"resource": ""
} |
q253947 | Resource.populate_resource_columns | validation | def populate_resource_columns(item_dict):
"""Operates on item_dict
Promotes the resource_name and resource_type fields to the
top-level of the serialization so they can be printed as columns.
Also makes a copies name field to type, which is a default column."""
item_dict['type']... | python | {
"resource": ""
} |
q253948 | Resource.set_display_columns | validation | def set_display_columns(self, set_true=[], set_false=[]):
"""Add or remove columns from the output."""
for i in range(len(self.fields)):
| python | {
"resource": ""
} |
q253949 | Resource.configure_display | validation | def configure_display(self, data, kwargs=None, write=False):
"""Populates columns and sets display attribute as needed.
Operates on data."""
if settings.format != 'human':
return # This is only used for human format
if write:
obj, obj_type, res, res_type = self.o... | python | {
"resource": ""
} |
q253950 | Resource.list | validation | def list(self, **kwargs):
"""Return a list of roles.
=====API DOCS=====
Retrieve a list of objects.
:param all_pages: Flag that if set, collect all pages of content from the API when returning results.
:type all_pages: bool
:param page: The page to show. Ignored if all_... | python | {
"resource": ""
} |
q253951 | Resource.get | validation | def get(self, pk=None, **kwargs):
"""Get information about a role.
=====API DOCS=====
Retrieve one and exactly one object.
:param pk: Primary key of the resource to be read. Tower CLI will only attempt to read *that* object
if ``pk`` is provided (not ``None``).
... | python | {
"resource": ""
} |
q253952 | _compare_node_lists | validation | def _compare_node_lists(old, new):
'''
Investigate two lists of workflow TreeNodes and categorize them.
There will be three types of nodes after categorization:
1. Nodes that only exists in the new list. These nodes will later be
created recursively.
2. Nodes that only exists in the... | python | {
"resource": ""
} |
q253953 | Resource._workflow_node_structure | validation | def _workflow_node_structure(node_results):
'''
Takes the list results from the API in `node_results` and
translates this data into a dictionary organized in a
human-readable heirarchial structure
'''
# Build list address translation, and create backlink lists
nod... | python | {
"resource": ""
} |
q253954 | Resource._get_schema | validation | def _get_schema(self, wfjt_id):
"""
Returns a dictionary that represents the node network of the
workflow job template
"""
node_res = get_resource('node')
| python | {
"resource": ""
} |
q253955 | Resource.associate_notification_template | validation | def associate_notification_template(self, workflow,
notification_template, status):
"""Associate a notification template from this workflow.
=====API DOCS=====
Associate a notification template from this workflow job template.
:param workflow: Th... | python | {
"resource": ""
} |
q253956 | Resource.disassociate_notification_template | validation | def disassociate_notification_template(self, workflow,
notification_template, status):
"""Disassociate a notification template from this workflow.
=====API DOCS=====
Disassociate a notification template from this workflow job template.
:param ... | python | {
"resource": ""
} |
q253957 | Resource.create | validation | def create(self, fail_on_found=False, force_on_exists=False, **kwargs):
"""Create a group.
=====API DOCS=====
Create a group.
:param parent: Primary key or name of the group which will be the parent of created group.
:type parent: str
:param fail_on_found: Flag that if ... | python | {
"resource": ""
} |
q253958 | Resource.list | validation | def list(self, root=False, **kwargs):
"""Return a list of groups.
=====API DOCS=====
Retrieve a list of groups.
:param root: Flag that if set, only root groups of a specific inventory will be listed.
:type root: bool
:param parent: Primary key or name of the group whose... | python | {
"resource": ""
} |
q253959 | Resource.associate | validation | def associate(self, group, parent, **kwargs):
"""Associate this group with the specified group.
=====API DOCS=====
Associate this group with the specified group.
:param group: Primary key or name of the child group to associate.
:type group: str
:param parent: Primary k... | python | {
"resource": ""
} |
q253960 | Resource.disassociate | validation | def disassociate(self, group, parent, **kwargs):
"""Disassociate this group from the specified group.
=====API DOCS=====
Disassociate this group with the specified group.
:param group: Primary key or name of the child group to disassociate.
:type group: str
:param paren... | python | {
"resource": ""
} |
q253961 | parse_kv | validation | def parse_kv(var_string):
"""Similar to the Ansible function of the same name, parses file
with a key=value pattern and stores information in a dictionary,
but not as fully featured as the corresponding Ansible code."""
return_dict = {}
# Output updates dictionaries, so return empty one if no vals ... | python | {
"resource": ""
} |
q253962 | process_extra_vars | validation | def process_extra_vars(extra_vars_list, force_json=True):
"""Returns a string that is valid JSON or YAML and contains all the
variables in every extra_vars_opt inside of extra_vars_list.
Args:
parse_kv (bool): whether to allow key=value syntax.
force_json (bool): if True, always output json.
... | python | {
"resource": ""
} |
q253963 | ordered_dump | validation | def ordered_dump(data, Dumper=yaml.Dumper, **kws):
"""Expand PyYAML's built-in dumper to support parsing OrderedDict. Return
a string as parse result of the original data structure, which includes
OrderedDict.
Args:
data: the data structure to be dumped(parsed) which is supposed to
cont... | python | {
"resource": ""
} |
q253964 | Client.get_prefix | validation | def get_prefix(self, include_version=True):
"""Return the appropriate URL prefix to prepend to requests,
based on the host provided in settings.
"""
host = settings.host
if '://' not in host:
host = 'https://%s' % host.strip('/')
elif host.startswith('http://'... | python | {
"resource": ""
} |
q253965 | Client.request | validation | def request(self, method, url, *args, **kwargs):
"""Make a request to the Ansible Tower API, and return the
response.
"""
# If the URL has the api/vX at the front strip it off
# This is common to have if you are extracting a URL from an existing object.
# For example, an... | python | {
"resource": ""
} |
q253966 | Resource._separate | validation | def _separate(self, kwargs):
"""Remove None-valued and configuration-related keyworded arguments
"""
self._pop_none(kwargs)
result = {}
for field in Resource.config_fields:
if field in kwargs:
result[field] = kwargs.pop(field)
if field ... | python | {
"resource": ""
} |
q253967 | Resource._configuration | validation | def _configuration(self, kwargs, config_item):
"""Combine configuration-related keyworded arguments into
notification_configuration.
"""
if 'notification_configuration' not in config_item:
if 'notification_type' not in kwargs:
return
nc = kwargs['n... | python | {
"resource": ""
} |
q253968 | Resource.create | validation | def create(self, fail_on_found=False, force_on_exists=False, **kwargs):
"""Create a notification template.
All required configuration-related fields (required according to
notification_type) must be provided.
There are two types of notification template creation: isolatedly
cre... | python | {
"resource": ""
} |
q253969 | Resource.modify | validation | def modify(self, pk=None, create_on_missing=False, **kwargs):
"""Modify an existing notification template.
Not all required configuration-related fields (required according to
notification_type) should be provided.
Fields in the resource's `identity` tuple can be used in lieu of a
... | python | {
"resource": ""
} |
q253970 | Resource.delete | validation | def delete(self, pk=None, fail_on_missing=False, **kwargs):
"""Remove the given notification template.
Note here configuration-related fields like
'notification_configuration' and 'channels' will not be
used even provided.
If `fail_on_missing` is True, then the object's not bei... | python | {
"resource": ""
} |
q253971 | Resource.list | validation | def list(self, all_pages=False, **kwargs):
"""Return a list of notification templates.
Note here configuration-related fields like
'notification_configuration' and 'channels' will not be
used even provided.
If one or more filters are provided through keyword arguments,
... | python | {
"resource": ""
} |
q253972 | Resource.get | validation | def get(self, pk=None, **kwargs):
"""Return one and exactly one notification template.
Note here configuration-related fields like
'notification_configuration' and 'channels' will not be
used even provided.
Lookups may be through a primary key, specified as a positional
... | python | {
"resource": ""
} |
q253973 | config_from_environment | validation | def config_from_environment():
"""Read tower-cli config values from the environment if present, being
careful not to override config values that were explicitly passed in.
"""
kwargs = {}
for k in CONFIG_OPTIONS:
env = 'TOWER_' + | python | {
"resource": ""
} |
q253974 | Parser._read | validation | def _read(self, fp, fpname):
"""Read the configuration from the given file.
If the file lacks any section header, add a [general] section
header that encompasses the whole thing.
"""
# Attempt to read the file using the superclass implementation.
#
# Check the pe... | python | {
"resource": ""
} |
q253975 | Settings.set_or_reset_runtime_param | validation | def set_or_reset_runtime_param(self, key, value):
"""Maintains the context of the runtime settings for invoking
a command.
This should be called by a click.option callback, and only
called once for each setting for each command invocation.
| python | {
"resource": ""
} |
q253976 | Resource.launch | validation | def launch(self, monitor=False, wait=False, timeout=None, **kwargs):
"""Launch a new ad-hoc command.
Runs a user-defined command from Ansible Tower, immediately starts it,
and returns back an ID in order for its status to be monitored.
=====API DOCS=====
Launch a new ad-hoc com... | python | {
"resource": ""
} |
q253977 | ResSubcommand._auto_help_text | validation | def _auto_help_text(self, help_text):
"""Given a method with a docstring, convert the docstring
to more CLI appropriate wording, and also disambiguate the
word "object" on the base class docstrings.
"""
# Delete API docs if there are any.
api_doc_delimiter = '=====API DOC... | python | {
"resource": ""
} |
q253978 | ResSubcommand._echo_method | validation | def _echo_method(self, method):
"""Given a method, return a method that runs the internal
method and echos the result.
"""
@functools.wraps(method)
def func(*args, **kwargs):
# Echo warning if this method is deprecated.
if getattr(method, 'deprecated', Fal... | python | {
"resource": ""
} |
q253979 | ResSubcommand._format_yaml | validation | def _format_yaml(self, payload):
"""Convert the payload into a YAML string with proper
indentation and return it.
"""
| python | {
"resource": ""
} |
q253980 | ResSubcommand._format_id | validation | def _format_id(self, payload):
"""Echos only the id"""
if 'id' in payload:
return str(payload['id'])
if 'results' in payload:
| python | {
"resource": ""
} |
q253981 | ResSubcommand.get_command | validation | def get_command(self, ctx, name):
"""Retrieve the appropriate method from the Resource,
decorate it as a click command, and return that method.
"""
# Sanity check: Does a method exist corresponding to this
# command? If not, None is returned for click to raise
# exception... | python | {
"resource": ""
} |
q253982 | Resource.update | validation | def update(self, inventory_source, monitor=False, wait=False,
timeout=None, **kwargs):
"""Update the given inventory source.
=====API DOCS=====
Update the given inventory source.
:param inventory_source: Primary key or name of the inventory source to be updated.
... | python | {
"resource": ""
} |
q253983 | Resource.list | validation | def list(self, group=None, host_filter=None, **kwargs):
"""Return a list of hosts.
=====API DOCS=====
Retrieve a list of hosts.
:param group: Primary key or name of the group whose hosts will be listed.
:type group: str
:param all_pages: Flag that if set, collect all pa... | python | {
"resource": ""
} |
q253984 | Resource.list_facts | validation | def list_facts(self, pk=None, **kwargs):
"""Return a JSON object of all available facts of the given host.
Note global option --format is not available here, as the output would always be JSON-formatted.
=====API DOCS=====
List all available facts of the given host.
:param pk:... | python | {
"resource": ""
} |
q253985 | TowerCLI.format_commands | validation | def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
self.format_command_subsection(
ctx, formatter, self.list_misc_commands(), 'Commands'
)
| python | {
"resource": ""
} |
q253986 | TowerCLI.list_commands | validation | def list_commands(self, ctx):
"""Return a list of commands present in the commands and resources
folders, but not subcommands.
"""
| python | {
"resource": ""
} |
q253987 | TowerCLI.list_resource_commands | validation | def list_resource_commands(self):
"""Returns a list of multi-commands for each resource type.
"""
resource_path = os.path.abspath(os.path.join(
os.path.dirname(__file__),
| python | {
"resource": ""
} |
q253988 | TowerCLI.list_misc_commands | validation | def list_misc_commands(self):
"""Returns a list of global commands, realted to CLI
configuration or system management | python | {
"resource": ""
} |
q253989 | TowerCLI.get_command | validation | def get_command(self, ctx, name):
"""Given a command identified by its name, import the appropriate
module and return the decorated command.
Resources are automatically commands, but if both a resource and
a command are defined, the command takes precedence.
"""
# First,... | python | {
"resource": ""
} |
q253990 | command | validation | def command(method=None, **kwargs):
"""Mark this method as a CLI command.
This will only have any meaningful effect in methods that are members of a
Resource subclass.
"""
# Create the actual decorator to be applied.
# This is done in such a way to make `@resources.command`,
# `@resources.c... | python | {
"resource": ""
} |
q253991 | unified_job_template_options | validation | def unified_job_template_options(method):
"""
Adds the decorators for all types of unified job templates,
and if the non-unified type is specified, converts it into the
unified_job_template kwarg.
"""
jt_dec = click.option(
'--job-template', type=types.Related('job_template'),
he... | python | {
"resource": ""
} |
q253992 | OAuth2Session.new_state | validation | def new_state(self):
"""Generates a state string to be used in authorizations."""
try:
self._state = self.state()
| python | {
"resource": ""
} |
q253993 | OAuth2Session.authorization_url | validation | def authorization_url(self, url, state=None, **kwargs):
"""Form an authorization URL.
:param url: Authorization endpoint url, must be HTTPS.
:param state: An optional state string for CSRF protection. If not
given it will be generated for you.
| python | {
"resource": ""
} |
q253994 | OAuth2Session.token_from_fragment | validation | def token_from_fragment(self, authorization_response):
"""Parse token from the URI fragment, used by MobileApplicationClients.
:param authorization_response: The full URL of the redirect back to you
:return: A token dict
"""
| python | {
"resource": ""
} |
q253995 | OAuth2Session.refresh_token | validation | def refresh_token(
self,
token_url,
refresh_token=None,
body="",
auth=None,
timeout=None,
headers=None,
verify=True,
proxies=None,
**kwargs
):
"""Fetch a new access token using a refresh token.
:param token_url: The tok... | python | {
"resource": ""
} |
q253996 | OAuth2Session.request | validation | def request(
self,
method,
url,
data=None,
headers=None,
withhold_token=False,
client_id=None,
client_secret=None,
**kwargs
):
"""Intercept all requests and add the OAuth 2 token if present."""
if not is_secure_transport(url):
... | python | {
"resource": ""
} |
q253997 | OAuth1Session.authorized | validation | def authorized(self):
"""Boolean that indicates whether this session has an OAuth token
or not. If `self.authorized` is True, you can reasonably expect
OAuth-protected requests to the resource to succeed. If
`self.authorized` is False, you need the user to go through the OAuth
au... | python | {
"resource": ""
} |
q253998 | OAuth1Session.authorization_url | validation | def authorization_url(self, url, request_token=None, **kwargs):
"""Create an authorization URL by appending request_token and optional
kwargs to url.
This is the second step in the OAuth 1 workflow. The user should be
redirected to this authorization URL, grant access to you, and then
... | python | {
"resource": ""
} |
q253999 | OAuth1Session.fetch_request_token | validation | def fetch_request_token(self, url, realm=None, **request_kwargs):
r"""Fetch a request token.
This is the first step in the OAuth 1 workflow. A request token is
obtained by making a signed post request to url. The token is then
parsed from the application/x-www-form-urlencoded response a... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.