obs_img_utils.utils module¶
- obs_img_utils.utils._get_dataline(data, widths)[source]¶
Function to get the a line with data for text output formatting
- obs_img_utils.utils._get_headersline(headers, widths)[source]¶
Function to get the headers line for text output formatting
- obs_img_utils.utils._get_separatorline(widths)[source]¶
Function to get the separator line for text output formatting
- obs_img_utils.utils._get_text_column_widths(headers, values)[source]¶
Function to get the column with required for text formatting
- obs_img_utils.utils.click_progress_callback(block_num, read_size, total_size, done=False)[source]¶
Update the module level progress bar with image download progress.
If download has finished flush stdout with render_finish.
- obs_img_utils.utils.conditions_repl(no_color)[source]¶
Query and accept input for condition options.
- obs_img_utils.utils.echo_package_json(name, data, no_color)[source]¶
Echoes package info to terminal based on name in json format.
- obs_img_utils.utils.echo_package_text(name, data, no_color, no_headers=False)[source]¶
Echoes package info to terminal based on name.
- obs_img_utils.utils.echo_packages_json(data, no_color)[source]¶
Echoes list of package info to terminal in json format.
- obs_img_utils.utils.echo_packages_text(data, no_color, no_headers=False)[source]¶
Echoes list of package info to terminal in text format.
- obs_img_utils.utils.filter_packages_by_licenses(packages_metadata, licenses)[source]¶
Returned a filtered dictionary of packages that matches the licenses.
- obs_img_utils.utils.filter_packages_by_name(packages_metadata, package_name)[source]¶
Returned a filtered dictionary of packages that matches the package names.
- obs_img_utils.utils.get_checksum_from_file(checksum_file)[source]¶
Get the checksum from OBS image.
Expects an inline signed file where checksum is on line 4.
- obs_img_utils.utils.get_config(cli_context)[source]¶
Process OBS Image utils config.
Use ChainMap to build config values based on command line args, config and defaults.
- obs_img_utils.utils.get_hash_from_image(image_file)[source]¶
Calculate hash of image read in from stream.
- obs_img_utils.utils.handle_errors(log_level, no_color)[source]¶
Context manager to handle exceptions and echo error msg.
- class obs_img_utils.utils.img_downloader_config(arch, checksum_extension, conditions_wait_time, config, download_url, extension, image_name, log_level, no_color, output, profile, signature_extension, target_dir)¶
Bases:
tuple
- __getnewargs__()¶
Return self as a plain tuple. Used by copy and pickle.
- __module__ = 'obs_img_utils.utils'¶
- static __new__(_cls, arch, checksum_extension, conditions_wait_time, config, download_url, extension, image_name, log_level, no_color, output, profile, signature_extension, target_dir)¶
Create new instance of img_downloader_config(arch, checksum_extension, conditions_wait_time, config, download_url, extension, image_name, log_level, no_color, output, profile, signature_extension, target_dir)
- __repr__()¶
Return a nicely formatted representation string
- __slots__ = ()¶
- _asdict()¶
Return a new OrderedDict which maps field names to their values.
- _field_defaults = {}¶
- _fields = ('arch', 'checksum_extension', 'conditions_wait_time', 'config', 'download_url', 'extension', 'image_name', 'log_level', 'no_color', 'output', 'profile', 'signature_extension', 'target_dir')¶
- _fields_defaults = {}¶
- classmethod _make(iterable)¶
Make a new img_downloader_config object from a sequence or iterable
- _replace(**kwds)¶
Return a new img_downloader_config object replacing specified fields with new values
- property arch¶
Alias for field number 0
- property checksum_extension¶
Alias for field number 1
- property conditions_wait_time¶
Alias for field number 2
- property config¶
Alias for field number 3
- property download_url¶
Alias for field number 4
- property extension¶
Alias for field number 5
- property image_name¶
Alias for field number 6
- property log_level¶
Alias for field number 7
- property no_color¶
Alias for field number 8
- property output¶
Alias for field number 9
- property profile¶
Alias for field number 10
- property signature_extension¶
Alias for field number 11
- property target_dir¶
Alias for field number 12
Update context with values for shared options.