INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Returns the actual target temperature. Attention: Returns None if the value can t be queried or is unknown. | def get_target_temperature(self):
"""
Returns the actual target temperature.
Attention: Returns None if the value can't be queried or is unknown.
"""
value = self.box.homeautoswitch("gethkrtsoll", self.actor_id)
self.target_temperature = self.__get_temp(value)
ret... |
Sets the temperature in celcius | def set_temperature(self, temp):
"""
Sets the temperature in celcius
"""
# Temperature is send to fritz.box a little weird
param = 16 + ( ( temp - 8 ) * 2 )
if param < 16:
param = 253
logger.info("Actor " + self.name + ": Temperature control set t... |
https:// <host > [: <port > ]/ | def get_openshift_base_uri(self):
"""
https://<host>[:<port>]/
:return: str
"""
deprecated_key = "openshift_uri"
key = "openshift_url"
val = self._get_value(deprecated_key, self.conf_section, deprecated_key)
if val is not None:
warnings.warn("... |
url of OpenShift where builder will connect | def get_builder_openshift_url(self):
""" url of OpenShift where builder will connect """
key = "builder_openshift_url"
url = self._get_deprecated(key, self.conf_section, key)
if url is None:
logger.warning("%r not found, falling back to get_openshift_base_uri()", key)
... |
helper method for generating nodeselector dict: param nodeselector_str:: return: dict | def generate_nodeselector_dict(self, nodeselector_str):
"""
helper method for generating nodeselector dict
:param nodeselector_str:
:return: dict
"""
nodeselector = {}
if nodeselector_str and nodeselector_str != 'none':
constraints = [x.strip() for x i... |
search the configuration for entries of the form node_selector. platform: param platform: str platform to search for can be null: return dict | def get_platform_node_selector(self, platform):
"""
search the configuration for entries of the form node_selector.platform
:param platform: str, platform to search for, can be null
:return dict
"""
nodeselector = {}
if platform:
nodeselector_str = sel... |
Extract tabular data as |TableData| instances from a CSV file. |load_source_desc_file| | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV file.
|load_source_desc_file|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format specifier ... |
Extract tabular data as |TableData| instances from a CSV text object. |load_source_desc_text| | def load(self):
"""
Extract tabular data as |TableData| instances from a CSV text object.
|load_source_desc_text|
:return:
Loaded table data.
|load_table_name_desc|
=================== ========================================
Format spec... |
set parameters according to specification | def set_params(self, **kwargs):
"""
set parameters according to specification
these parameters are accepted:
:param pulp_secret: str, resource name of pulp secret
:param koji_target: str, koji tag with packages used to build the image
:param kojiroot: str, URL from whic... |
Return True if this BuildConfig has ImageStreamTag trigger. | def has_ist_trigger(self):
"""Return True if this BuildConfig has ImageStreamTag trigger."""
triggers = self.template['spec'].get('triggers', [])
if not triggers:
return False
for trigger in triggers:
if trigger['type'] == 'ImageChange' and \
t... |
Sets secret for plugin if no plugin specified it will also set general secret | def set_secret_for_plugin(self, secret, plugin=None, mount_path=None):
"""
Sets secret for plugin, if no plugin specified
it will also set general secret
:param secret: str, secret name
:param plugin: tuple, (plugin type, plugin name, argument name)
:param mount_path: st... |
: param secrets: dict { ( plugin type plugin name argument name ): secret name } for example { ( exit_plugins koji_promote koji_ssl_certs ): koji_ssl_certs... } | def set_secrets(self, secrets):
"""
:param secrets: dict, {(plugin type, plugin name, argument name): secret name}
for example {('exit_plugins', 'koji_promote', 'koji_ssl_certs'): 'koji_ssl_certs', ...}
"""
secret_set = False
for (plugin, secret) in secrets.items():
... |
Remove matching entries from tag_and_push_registries ( in - place ) | def remove_tag_and_push_registries(tag_and_push_registries, version):
"""
Remove matching entries from tag_and_push_registries (in-place)
:param tag_and_push_registries: dict, uri -> dict
:param version: str, 'version' to match against
"""
registries = [uri
... |
Enable/ disable plugins depending on supported registry API versions | def adjust_for_registry_api_versions(self):
"""
Enable/disable plugins depending on supported registry API versions
"""
versions = self.spec.registry_api_versions.value
if 'v2' not in versions:
raise OsbsValidationException('v1-only docker registry API is not support... |
Remove trigger - related plugins when needed | def adjust_for_triggers(self):
"""Remove trigger-related plugins when needed
If there are no triggers defined, it's assumed the
feature is disabled and all trigger-related plugins
are removed.
If there are triggers defined, and this is a custom
base image, some trigger-... |
Remove certain plugins in order to handle the scratch build scenario. Scratch builds must not affect subsequent builds and should not be imported into Koji. | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.scratch:
self.template['spec'].pop('triggers', None)
... |
Disable plugins to handle builds depending on whether or not this is a build from a custom base image. | def adjust_for_custom_base_image(self):
"""
Disable plugins to handle builds depending on whether
or not this is a build from a custom base image.
"""
plugins = []
if self.is_custom_base_image():
# Plugins irrelevant to building base images.
plugin... |
if there is yum repo specified don t pick stuff from koji | def render_koji(self):
"""
if there is yum repo specified, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.yum_repourls.value:
logger.in... |
If the bump_release plugin is present configure it | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.release.value:
logge... |
if we have smtp_host and smtp_from configure sendmail plugin else remove it | def render_sendmail(self):
"""
if we have smtp_host and smtp_from, configure sendmail plugin,
else remove it
"""
phase = 'exit_plugins'
plugin = 'sendmail'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
if self.spec.smtp_host.... |
Configure fetch_maven_artifacts plugin | def render_fetch_maven_artifacts(self):
"""Configure fetch_maven_artifacts plugin"""
phase = 'prebuild_plugins'
plugin = 'fetch_maven_artifacts'
if not self.dj.dock_json_has_plugin_conf(phase, plugin):
return
koji_hub = self.spec.kojihub.value
koji_root = sel... |
Configure tag_from_config plugin | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.spec.image_tag.value.split(':')[-1]
tag_suffixes = {'unique': ... |
If a pulp registry is specified use pulp_pull plugin | def render_pulp_pull(self):
"""
If a pulp registry is specified, use pulp_pull plugin
"""
# pulp_pull is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'pulp_pull'
for phase in phases:
if not self.dj.dock_json_has_plugin_c... |
If a pulp registry is specified use the pulp plugin as well as the delete_from_registry to delete the image after sync | def render_pulp_sync(self):
"""
If a pulp registry is specified, use the pulp plugin as well as the
delete_from_registry to delete the image after sync
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_sync'):... |
Configure the pulp_tag plugin. | def render_pulp_tag(self):
"""
Configure the pulp_tag plugin.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins',
'pulp_tag'):
return
pulp_registry = self.spec.pulp_registry.value
if pulp_registry... |
Configure the group_manifests plugin. Group is always set to false for now. | def render_group_manifests(self):
"""
Configure the group_manifests plugin. Group is always set to false for now.
"""
if not self.dj.dock_json_has_plugin_conf('postbuild_plugins', 'group_manifests'):
return
push_conf = self.dj.dock_json_get_plugin_conf('postbuild_plu... |
Configure the import_image plugin | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
phases = ('postbuild_plugins', 'exit_plugins')
plugin = 'import_image'
for phase in phases:
if self.spec.imagestream_name.va... |
Customize prod_inner for site specific customizations | def render_customizations(self):
"""
Customize prod_inner for site specific customizations
"""
disable_plugins = self.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug("No site-specific plugins to disable")
else:
for p... |
Sets the Build/ BuildConfig object name | def render_name(self, name, image_tag, platform):
"""Sets the Build/BuildConfig object name"""
if self.scratch or self.isolated:
name = image_tag
# Platform name may contain characters not allowed by OpenShift.
if platform:
platform_suffix = '-{}'.for... |
Only used for setting up the testing framework. | def setup_json_capture(osbs, os_conf, capture_dir):
"""
Only used for setting up the testing framework.
"""
try:
os.mkdir(capture_dir)
except OSError:
pass
finally:
osbs.os._con.request = ResponseSaver(capture_dir,
os_conf.get... |
get size of console: rows x columns | def get_terminal_size():
"""
get size of console: rows x columns
:return: tuple, (int, int)
"""
try:
rows, columns = subprocess.check_output(['stty', 'size']).split()
except subprocess.CalledProcessError:
# not attached to terminal
logger.info("not attached to terminal")... |
get size of longest value in specific column | def _longest_val_in_column(self, col):
"""
get size of longest value in specific column
:param col: str, column name
:return int
"""
try:
# +2 is for implicit separator
return max([len(x[col]) for x in self.table if x[col]]) + 2
except Key... |
initialize all values based on provided input | def _init(self):
"""
initialize all values based on provided input
:return: None
"""
self.col_count = len(self.col_list)
# list of lengths of longest entries in columns
self.col_longest = self.get_all_longest_col_lengths()
self.data_length = sum(self.col_... |
count all values needed to display whole table | def _count_sizes(self):
"""
count all values needed to display whole table
<><---terminal-width-----------><>
<> HEADER | HEADER2 | HEADER3 <>
<>---------+----------+---------<>
kudos to PostgreSQL developers
:return: None
"""
format_list = [... |
iterate over all columns and get their longest values | def get_all_longest_col_lengths(self):
"""
iterate over all columns and get their longest values
:return: dict, {"column_name": 132}
"""
response = {}
for col in self.col_list:
response[col] = self._longest_val_in_column(col)
return response |
get a width of separator for current column | def _separate(self):
"""
get a width of separator for current column
:return: int
"""
if self.total_free_space is None:
return 0
else:
sepa = self.default_column_space
# we need to distribute remainders
if self.default_colu... |
print provided table | def render(self):
"""
print provided table
:return: None
"""
print(self.format_str.format(**self.header), file=sys.stderr)
print(self.header_format_str.format(**self.header_data), file=sys.stderr)
for row in self.data:
print(self.format_str.format(**r... |
: raises ValidationError: | def _validate_source_data(self):
"""
:raises ValidationError:
"""
try:
jsonschema.validate(self._buffer, self._schema)
except jsonschema.ValidationError as e:
raise ValidationError(e) |
: raises ValueError:: raises pytablereader. error. ValidationError: | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
self._loader.inc_table_count()
yield TableData(
self._make_table_name(),
["key", "value"],
[record ... |
: raises ValueError:: raises pytablereader. error. ValidationError: | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
attr_name_set = set()
for json_record in json_records:
... |
: raises ValueError:: raises pytablereader. error. ValidationError: | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
headers = sorted(six.viewkeys(json_records))
self._loader.... |
: raises ValueError:: raises pytablereader. error. ValidationError: | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
for table_key, json_records in six.iteritems(self._buffer):
self._loader.inc_table_count()
self._table_key = table_key
... |
set parameters in the user parameters | def set_params(self, **kwargs):
"""
set parameters in the user parameters
these parameters are accepted:
:param git_uri: str, uri of the git repository for the source
:param git_ref: str, commit ID of the branch to be pulled
:param git_branch: str, branch name of the bra... |
Sets data from reactor config | def set_data_from_reactor_config(self):
"""
Sets data from reactor config
"""
reactor_config_override = self.user_params.reactor_config_override.value
reactor_config_map = self.user_params.reactor_config_map.value
data = None
if reactor_config_override:
... |
Sets required secrets | def _set_required_secrets(self, required_secrets, token_secrets):
"""
Sets required secrets
"""
if self.user_params.build_type.value == BUILD_TYPE_ORCHESTRATOR:
required_secrets += token_secrets
if not required_secrets:
return
secrets = self.temp... |
if config contains plugin remove it | def remove_plugin(self, phase, name, reason=None):
"""
if config contains plugin, remove it
"""
for p in self.template[phase]:
if p.get('name') == name:
self.template[phase].remove(p)
if reason:
logger.info('Removing {}:{}, ... |
if config has plugin override it else add it | def add_plugin(self, phase, name, args, reason=None):
"""
if config has plugin, override it, else add it
"""
plugin_modified = False
for plugin in self.template[phase]:
if plugin['name'] == name:
plugin['args'] = args
plugin_modified =... |
Return the configuration for a plugin. | def get_plugin_conf(self, phase, name):
"""
Return the configuration for a plugin.
Raises KeyError if there are no plugins of that type.
Raises IndexError if the named plugin is not listed.
"""
match = [x for x in self.template[phase] if x.get('name') == name]
re... |
Check whether a plugin is configured. | def has_plugin_conf(self, phase, name):
"""
Check whether a plugin is configured.
"""
try:
self.get_plugin_conf(phase, name)
return True
except (KeyError, IndexError):
return False |
Remove certain plugins in order to handle the scratch build scenario. Scratch builds must not affect subsequent builds and should not be imported into Koji. | def adjust_for_scratch(self):
"""
Remove certain plugins in order to handle the "scratch build"
scenario. Scratch builds must not affect subsequent builds,
and should not be imported into Koji.
"""
if self.user_params.scratch.value:
remove_plugins = [
... |
Remove certain plugins in order to handle the isolated build scenario. | def adjust_for_isolated(self):
"""
Remove certain plugins in order to handle the "isolated build"
scenario.
"""
if self.user_params.isolated.value:
remove_plugins = [
("prebuild_plugins", "check_and_set_rebuild"),
("prebuild_plugins", "... |
Remove plugins that don t work when building Flatpaks | def adjust_for_flatpak(self):
"""
Remove plugins that don't work when building Flatpaks
"""
if self.user_params.flatpak.value:
remove_plugins = [
("prebuild_plugins", "resolve_composes"),
# We'll extract the filesystem anyways for a Flatpak ins... |
Customize template for site user specified customizations | def render_customizations(self):
"""
Customize template for site user specified customizations
"""
disable_plugins = self.pt.customize_conf.get('disable_plugins', [])
if not disable_plugins:
logger.debug('No site-user specified plugins to disable')
else:
... |
if there is yum repo in user params don t pick stuff from koji | def render_koji(self):
"""
if there is yum repo in user params, don't pick stuff from koji
"""
phase = 'prebuild_plugins'
plugin = 'koji'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.yum_repourls.value:
self.pt... |
If the bump_release plugin is present configure it | def render_bump_release(self):
"""
If the bump_release plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'bump_release'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.release.value:
self.pt.... |
If the check_and_set_platforms plugin is present configure it | def render_check_and_set_platforms(self):
"""
If the check_and_set_platforms plugin is present, configure it
"""
phase = 'prebuild_plugins'
plugin = 'check_and_set_platforms'
if not self.pt.has_plugin_conf(phase, plugin):
return
if self.user_params.ko... |
Configure the import_image plugin | def render_import_image(self, use_auth=None):
"""
Configure the import_image plugin
"""
# import_image is a multi-phase plugin
if self.user_params.imagestream_name.value is None:
self.pt.remove_plugin('exit_plugins', 'import_image',
'... |
Configure tag_from_config plugin | def render_tag_from_config(self):
"""Configure tag_from_config plugin"""
phase = 'postbuild_plugins'
plugin = 'tag_from_config'
if not self.has_tag_suffixes_placeholder():
return
unique_tag = self.user_params.image_tag.value.split(':')[-1]
tag_suffixes = {'un... |
Configure pull_base_image | def render_pull_base_image(self):
"""Configure pull_base_image"""
phase = 'prebuild_plugins'
plugin = 'pull_base_image'
if self.user_params.parent_images_digests.value:
self.pt.set_plugin_arg(phase, plugin, 'parent_images_digests',
self.use... |
get info about user ( if no user specified use the one initiating request ) | def get_user(self, username="~"):
"""
get info about user (if no user specified, use the one initiating request)
:param username: str, name of user to get info about, default="~"
:return: dict
"""
url = self._build_url("users/%s/" % username, _prepend_namespace=False)
... |
: return: | def create_build(self, build_json):
"""
:return:
"""
url = self._build_url("builds/")
logger.debug(build_json)
return self._post(url, data=json.dumps(build_json),
headers={"Content-Type": "application/json"}) |
Returns all builds matching a given set of label selectors. It is up to the calling function to filter the results. | def get_all_build_configs_by_labels(self, label_selectors):
"""
Returns all builds matching a given set of label selectors. It is up to the
calling function to filter the results.
"""
labels = ['%s=%s' % (field, value) for field, value in label_selectors]
labels = ','.joi... |
Returns a build config matching the given label selectors. This method will raise OsbsException if not exactly one build config is found. | def get_build_config_by_labels(self, label_selectors):
"""
Returns a build config matching the given label
selectors. This method will raise OsbsException
if not exactly one build config is found.
"""
items = self.get_all_build_configs_by_labels(label_selectors)
... |
Returns a build config matching the given label selectors filtering against another predetermined value. This method will raise OsbsException if not exactly one build config is found after filtering. | def get_build_config_by_labels_filtered(self, label_selectors, filter_key, filter_value):
"""
Returns a build config matching the given label selectors, filtering against
another predetermined value. This method will raise OsbsException
if not exactly one build config is found after filt... |
: return: | def create_build_config(self, build_config_json):
"""
:return:
"""
url = self._build_url("buildconfigs/")
return self._post(url, data=build_config_json,
headers={"Content-Type": "application/json"}) |
stream logs from build | def stream_logs(self, build_id):
"""
stream logs from build
:param build_id: str
:return: iterator
"""
kwargs = {'follow': 1}
# If connection is closed within this many seconds, give up:
min_idle_timeout = 60
# Stream logs, but be careful of the... |
provide logs from build | def logs(self, build_id, follow=False, build_json=None, wait_if_missing=False):
"""
provide logs from build
:param build_id: str
:param follow: bool, fetch logs as they come?
:param build_json: dict, to save one get-build query
:param wait_if_missing: bool, if build does... |
List builds matching criteria | def list_builds(self, build_config_id=None, koji_task_id=None,
field_selector=None, labels=None):
"""
List builds matching criteria
:param build_config_id: str, only list builds created from BuildConfig
:param koji_task_id: str, only list builds for Koji Task ID
... |
Prevent builds being scheduled and wait for running builds to finish. | def create_resource_quota(self, name, quota_json):
"""
Prevent builds being scheduled and wait for running builds to finish.
:return:
"""
url = self._build_k8s_url("resourcequotas/")
response = self._post(url, data=json.dumps(quota_json),
h... |
: param build_id: wait for build to finish | def wait(self, build_id, states):
"""
:param build_id: wait for build to finish
:return:
"""
logger.info("watching build '%s'", build_id)
for changetype, obj in self.watch_resource("builds", build_id):
try:
obj_name = obj["metadata"]["name"]
... |
adjust labels or annotations on object | def adjust_attributes_on_object(self, collection, name, things, values, how):
"""
adjust labels or annotations on object
labels have to match RE: (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? and
have at most 63 chars
:param collection: str, object collection e.g. 'builds'
... |
set annotations on build object | def update_annotations_on_build(self, build_id, annotations):
"""
set annotations on build object
:param build_id: str, id of build
:param annotations: dict, annotations to set
:return:
"""
return self.adjust_attributes_on_object('builds', build_id,
... |
Import image tags from a Docker registry into an ImageStream | def import_image(self, name, stream_import, tags=None):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name).json()
logger... |
Import image tags from a Docker registry into an ImageStream | def import_image_tags(self, name, stream_import, tags, repository, insecure):
"""
Import image tags from a Docker registry into an ImageStream
:return: bool, whether tags were imported
"""
# Get the JSON for the ImageStream
imagestream_json = self.get_image_stream(name)... |
argparse is way too awesome when doing repr () on choices when printing usage | def str_on_2_unicode_on_3(s):
"""
argparse is way too awesome when doing repr() on choices when printing usage
:param s: str or unicode
:return: str on 2, unicode on 3
"""
if not PY3:
return str(s)
else: # 3+
if not isinstance(s, str):
return str(s, encoding="u... |
Extract tabular data as |TableData| instances from a Line - delimited JSON file. |load_source_desc_file| | def load(self):
"""
Extract tabular data as |TableData| instances from a Line-delimited JSON file.
|load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
:rtype: |TableData| iterator
:raises pytablereader.DataError:
... |
Load table data from a Google Spreadsheet. | def load(self):
"""
Load table data from a Google Spreadsheet.
This method consider :py:attr:`.source` as a path to the
credential JSON file to access Google Sheets API.
The method automatically search the header row start from
:py:attr:`.start_row`. The condition of th... |
Set logging level of this module. Using logbook <https:// logbook. readthedocs. io/ en/ stable/ > __ module for logging. | def set_log_level(log_level):
"""
Set logging level of this module. Using
`logbook <https://logbook.readthedocs.io/en/stable/>`__ module for logging.
:param int log_level:
One of the log level of
`logbook <https://logbook.readthedocs.io/en/stable/api/base.html>`__.
Disabled logg... |
Performs update of given orig BuildConfig with values from new BuildConfig. Both BuildConfigs have to be represented as dict s. | def buildconfig_update(orig, new, remove_nonexistent_keys=False):
"""Performs update of given `orig` BuildConfig with values from `new` BuildConfig.
Both BuildConfigs have to be represented as `dict`s.
This function:
- adds all key/value pairs to `orig` from `new` that are missing
- replaces values... |
clone provided git repo to target_dir optionally checkout provided commit yield the ClonedRepoData and delete the repo when finished | def checkout_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES,
branch=None, depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
yield the ClonedRepoData and delete the repo when finished
:param git_url: str, git re... |
clone provided git repo to target_dir optionally checkout provided commit | def clone_git_repo(git_url, target_dir=None, commit=None, retry_times=GIT_MAX_RETRIES, branch=None,
depth=None):
"""
clone provided git repo to target_dir, optionally checkout provided commit
:param git_url: str, git repo to clone
:param target_dir: str, filesystem path where the rep... |
hard reset git clone in target_dir to given git_reference | def reset_git_repo(target_dir, git_reference, retry_depth=None):
"""
hard reset git clone in target_dir to given git_reference
:param target_dir: str, filesystem path where the repo is cloned
:param git_reference: str, any valid git reference
:param retry_depth: int, if the repo was cloned with --s... |
return ImageStreamTag give a FROM value | def get_imagestreamtag_from_image(image):
"""
return ImageStreamTag, give a FROM value
:param image: str, the FROM value from the Dockerfile
:return: str, ImageStreamTag
"""
ret = image
# Remove the registry part
ret = strip_registry_from_image(image)
# ImageStream names cannot co... |
return time tuple from an RFC 3339 - formatted time string | def get_time_from_rfc3339(rfc3339):
"""
return time tuple from an RFC 3339-formatted time string
:param rfc3339: str, time in RFC 3339 format
:return: float, seconds since the Epoch
"""
try:
# py 3
dt = dateutil.parser.parse(rfc3339, ignoretz=False)
return dt.timestamp... |
OpenShift requires labels to be no more than 64 characters and forbids any characters other than alphanumerics. and -. BuildConfig names are similar but cannot contain/. | def sanitize_strings_for_openshift(str1, str2='', limit=LABEL_MAX_CHARS, separator='-',
label=True):
"""
OpenShift requires labels to be no more than 64 characters and forbids any characters other
than alphanumerics, ., and -. BuildConfig names are similar, but cannot cont... |
return name string representing the given git repo and branch to be used as a build name. | def make_name_from_git(repo, branch, limit=53, separator='-', hash_size=5):
"""
return name string representing the given git repo and branch
to be used as a build name.
NOTE: Build name will be used to generate pods which have a
limit of 64 characters and is composed as:
<buildname>-<buil... |
wraps the result of make_name_from_git in a suffix and postfix adding separators for each. | def wrap_name_from_git(prefix, suffix, *args, **kwargs):
"""
wraps the result of make_name_from_git in a suffix and postfix
adding separators for each.
see docstring for make_name_from_git for a full list of parameters
"""
# 64 is maximum length allowed by OpenShift
# 2 is the number of das... |
Take parse_version () output and standardize output from older setuptools parse_version () to match current setuptools. | def sanitize_version(version):
"""
Take parse_version() output and standardize output from older
setuptools' parse_version() to match current setuptools.
"""
if hasattr(version, 'base_version'):
if version.base_version:
parts = version.base_version.split('.')
else:
... |
returns the most preferred label name if there isn t any correct name in the list it will return newest label name | def get_name(self, label_type):
"""
returns the most preferred label name
if there isn't any correct name in the list
it will return newest label name
"""
if label_type in self._label_values:
return self._label_values[label_type][0]
else:
r... |
Return dictionary new label name indexed by old label name. | def get_new_names_by_old():
"""Return dictionary, new label name indexed by old label name."""
newdict = {}
for label_type, label_names in Labels.LABEL_NAMES.items():
for oldname in label_names[1:]:
newdict[oldname] = Labels.LABEL_NAMES[label_type][0]
return ... |
Return tuple of ( label name label value ) Raises KeyError if label doesn t exist | def get_name_and_value(self, label_type):
"""
Return tuple of (label name, label value)
Raises KeyError if label doesn't exist
"""
if label_type in self._label_values:
return self._label_values[label_type]
else:
return (label_type, self._df_labels[... |
Checks whether kerberos credential cache has ticket - granting ticket that is valid for at least an hour. | def kerberos_ccache_init(principal, keytab_file, ccache_file=None):
"""
Checks whether kerberos credential cache has ticket-granting ticket that is valid for at least
an hour.
Default ccache is used unless ccache_file is provided. In that case, KRB5CCNAME environment
variable is set to the value of... |
Extract tabular data as |TableData| instances from a SQLite database file. |load_source_desc_file| | def load(self):
"""
Extract tabular data as |TableData| instances from a SQLite database
file. |load_source_desc_file|
:return:
Loaded table data iterator.
|load_table_name_desc|
=================== ==============================================
... |
Find the data stored in the config_map | def get_data(self):
"""
Find the data stored in the config_map
:return: dict, the json of the data data that was passed into the ConfigMap on creation
"""
data = graceful_chain_get(self.json, "data")
if data is None:
return {}
data_dict = {}
... |
Find the object stored by a JSON string at key name | def get_data_by_key(self, name):
"""
Find the object stored by a JSON string at key 'name'
:return: str or dict, the json of the str or dict stored in the ConfigMap at that location
"""
data = graceful_chain_get(self.json, "data")
if data is None or name not in data:
... |
: raises ValueError:: raises pytablereader. error. ValidationError: | def to_table_data(self):
"""
:raises ValueError:
:raises pytablereader.error.ValidationError:
"""
self._validate_source_data()
header_list = []
for json_record in self._buffer:
for key in json_record:
if key not in header_list:
... |
List builds with matching fields | def list_builds(self, field_selector=None, koji_task_id=None, running=None,
labels=None):
"""
List builds with matching fields
:param field_selector: str, field selector for Builds
:param koji_task_id: str, only list builds for Koji Task ID
:return: BuildResp... |
: return: PodResponse object for pod relating to the build | def get_pod_for_build(self, build_id):
"""
:return: PodResponse object for pod relating to the build
"""
pods = self.os.list_pods(label='openshift.io/build.name=%s' % build_id)
serialized_response = pods.json()
pod_list = [PodResponse(pod) for pod in serialized_response["... |
return instance of BuildRequest or BuildRequestV2 | def get_build_request(self, build_type=None, inner_template=None,
outer_template=None, customize_conf=None,
arrangement_version=DEFAULT_ARRANGEMENT_VERSION):
"""
return instance of BuildRequest or BuildRequestV2
:param build_type: str, unused
... |
render provided build_request and submit build from it | def create_build_from_buildrequest(self, build_request):
"""
render provided build_request and submit build from it
:param build_request: instance of build.build_request.BuildRequest
:return: instance of build.build_response.BuildResponse
"""
build_request.set_openshift_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.