2018-05-12 00:18:21 +00:00
<!DOCTYPE html>
<!-- [if IE 8]><html class="no - js lt - ie9" lang="en" > <![endif] -->
<!-- [if gt IE 8]><! --> < html class = "no-js" lang = "en" > <!-- <![endif] -->
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2019-06-18 22:02:04 +00:00
< title > pylorax.api.compose — Lorax 31.7 documentation< / title >
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
< script type = "text/javascript" src = "../../../_static/js/modernizr.min.js" > < / script >
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
< script type = "text/javascript" id = "documentation_options" data-url_root = "../../../" src = "../../../_static/documentation_options.js" > < / script >
< script type = "text/javascript" src = "../../../_static/jquery.js" > < / script >
< script type = "text/javascript" src = "../../../_static/underscore.js" > < / script >
< script type = "text/javascript" src = "../../../_static/doctools.js" > < / script >
< script type = "text/javascript" src = "../../../_static/language_data.js" > < / script >
< script type = "text/javascript" src = "../../../_static/js/theme.js" > < / script >
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
2018-11-13 17:53:31 +00:00
< link rel = "stylesheet" href = "../../../_static/css/theme.css" type = "text/css" / >
2018-05-12 00:18:21 +00:00
< link rel = "stylesheet" href = "../../../_static/pygments.css" type = "text/css" / >
< link rel = "index" title = "Index" href = "../../../genindex.html" / >
< link rel = "search" title = "Search" href = "../../../search.html" / >
< / head >
< body class = "wy-body-for-nav" >
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
< div class = "wy-side-scroll" >
2019-03-27 23:44:14 +00:00
< div class = "wy-side-nav-search" >
2018-05-12 00:18:21 +00:00
< a href = "../../../index.html" class = "icon icon-home" > Lorax
< / a >
< div class = "version" >
2019-06-18 22:02:04 +00:00
31.7
2018-05-12 00:18:21 +00:00
< / div >
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "../../../search.html" method = "get" >
< input type = "text" name = "q" placeholder = "Search docs" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< / div >
< div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "main navigation" >
< ul >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html" > Introduction to Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html#before-lorax" > Before Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../lorax.html" > Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../livemedia-creator.html" > livemedia-creator< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../lorax-composer.html" > lorax-composer< / a > < / li >
2018-10-24 17:07:32 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../composer-cli.html" > composer-cli< / a > < / li >
2018-05-12 00:18:21 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../product-images.html" > Product and Updates Images< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../modules.html" > src< / a > < / li >
< / ul >
< / div >
< / div >
< / nav >
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" >
< nav class = "wy-nav-top" aria-label = "top navigation" >
< i data-toggle = "wy-nav-top" class = "fa fa-bars" > < / i >
< a href = "../../../index.html" > Lorax< / a >
< / nav >
< div class = "wy-nav-content" >
< div class = "rst-content" >
< div role = "navigation" aria-label = "breadcrumbs navigation" >
< ul class = "wy-breadcrumbs" >
< li > < a href = "../../../index.html" > Docs< / a > » < / li >
< li > < a href = "../../index.html" > Module code< / a > » < / li >
< li > < a href = "../../pylorax.html" > pylorax< / a > » < / li >
< li > pylorax.api.compose< / li >
< li class = "wy-breadcrumbs-aside" >
< / li >
< / ul >
< hr / >
< / div >
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
< h1 > Source code for pylorax.api.compose< / h1 > < div class = "highlight" > < pre >
2019-03-27 23:44:14 +00:00
< span > < / span > < span class = "c1" > # Copyright (C) 2018-2019 Red Hat, Inc.< / span >
2018-05-12 00:18:21 +00:00
< span class = "c1" > #< / span >
< span class = "c1" > # This program is free software; you can redistribute it and/or modify< / span >
< span class = "c1" > # it under the terms of the GNU General Public License as published by< / span >
< span class = "c1" > # the Free Software Foundation; either version 2 of the License, or< / span >
< span class = "c1" > # (at your option) any later version.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is distributed in the hope that it will be useful,< / span >
< span class = "c1" > # but WITHOUT ANY WARRANTY; without even the implied warranty of< / span >
< span class = "c1" > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the< / span >
< span class = "c1" > # GNU General Public License for more details.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # You should have received a copy of the GNU General Public License< / span >
< span class = "c1" > # along with this program. If not, see < http://www.gnu.org/licenses/> .< / span >
< span class = "c1" > #< / span >
< span class = "sd" > " " " Setup for composing an image< / span >
< span class = "sd" > Adding New Output Types< / span >
< span class = "sd" > -----------------------< / span >
< span class = "sd" > The new output type must add a kickstart template to ./share/composer/ where the< / span >
< span class = "sd" > name of the kickstart (without the trailing .ks) matches the entry in compose_args.< / span >
< span class = "sd" > The kickstart should not have any url or repo entries, these will be added at build< / span >
< span class = "sd" > time. The %packages section should be the last thing, and while it can contain mandatory< / span >
< span class = "sd" > packages required by the output type, it should not have the trailing %end because the< / span >
< span class = "sd" > package NEVRAs will be appended to it at build time.< / span >
< span class = "sd" > compose_args should have a name matching the kickstart, and it should set the novirt_install< / span >
< span class = "sd" > parameters needed to generate the desired output. Other types should be set to False.< / span >
< span class = "sd" > " " " < / span >
< span class = "kn" > import< / span > < span class = "nn" > logging< / span >
< span class = "n" > log< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > getLogger< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax-composer" < / span > < span class = "p" > )< / span >
< span class = "kn" > import< / span > < span class = "nn" > os< / span >
< span class = "kn" > from< / span > < span class = "nn" > glob< / span > < span class = "k" > import< / span > < span class = "n" > glob< / span >
2019-03-27 23:44:14 +00:00
< span class = "kn" > from< / span > < span class = "nn" > io< / span > < span class = "k" > import< / span > < span class = "n" > StringIO< / span >
2018-05-12 00:18:21 +00:00
< span class = "kn" > from< / span > < span class = "nn" > math< / span > < span class = "k" > import< / span > < span class = "n" > ceil< / span >
< span class = "kn" > import< / span > < span class = "nn" > shutil< / span >
< span class = "kn" > from< / span > < span class = "nn" > uuid< / span > < span class = "k" > import< / span > < span class = "n" > uuid4< / span >
< span class = "c1" > # Use pykickstart to calculate disk image size< / span >
< span class = "kn" > from< / span > < span class = "nn" > pykickstart.parser< / span > < span class = "k" > import< / span > < span class = "n" > KickstartParser< / span >
< span class = "kn" > from< / span > < span class = "nn" > pykickstart.version< / span > < span class = "k" > import< / span > < span class = "n" > makeVersion< / span >
2019-03-27 23:44:14 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax< / span > < span class = "k" > import< / span > < span class = "n" > ArchData< / span > < span class = "p" > ,< / span > < span class = "n" > find_templates< / span > < span class = "p" > ,< / span > < span class = "n" > get_buildarch< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.gitrpm< / span > < span class = "k" > import< / span > < span class = "n" > create_gitrpm_repo< / span >
2018-07-20 22:51:06 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.projects< / span > < span class = "k" > import< / span > < span class = "n" > projects_depsolve< / span > < span class = "p" > ,< / span > < span class = "n" > projects_depsolve_with_size< / span > < span class = "p" > ,< / span > < span class = "n" > dep_nevra< / span >
2018-05-12 00:18:21 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.projects< / span > < span class = "k" > import< / span > < span class = "n" > ProjectsError< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.recipes< / span > < span class = "k" > import< / span > < span class = "n" > read_recipe_and_id< / span >
2018-08-13 23:43:20 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.timestamp< / span > < span class = "k" > import< / span > < span class = "n" > TS_CREATED< / span > < span class = "p" > ,< / span > < span class = "n" > write_timestamp< / span >
2019-06-18 22:02:04 +00:00
< span class = "kn" > import< / span > < span class = "nn" > pylorax.api.toml< / span > < span class = "k" > as< / span > < span class = "nn" > toml< / span >
2019-03-27 23:44:14 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.base< / span > < span class = "k" > import< / span > < span class = "n" > DataHolder< / span >
2018-05-12 00:18:21 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.imgutils< / span > < span class = "k" > import< / span > < span class = "n" > default_image_name< / span >
2019-03-27 23:44:14 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.ltmpl< / span > < span class = "k" > import< / span > < span class = "n" > LiveTemplateRunner< / span >
2018-09-06 17:37:53 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.sysutils< / span > < span class = "k" > import< / span > < span class = "n" > joinpaths< / span > < span class = "p" > ,< / span > < span class = "n" > flatconfig< / span >
2018-05-12 00:18:21 +00:00
2018-07-20 22:51:06 +00:00
< div class = "viewcode-block" id = "test_templates" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.test_templates" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > test_templates< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > share_dir< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Try depsolving each of the the templates and report any errors< / span >
< span class = "sd" > :param dbo: dnf base object< / span >
< span class = "sd" > :type dbo: dnf.Base< / span >
< span class = "sd" > :returns: List of template types and errors< / span >
< span class = "sd" > :rtype: List of errors< / span >
< span class = "sd" > Return a list of templates and errors encountered or an empty list< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > template_errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > compose_type< / span > < span class = "ow" > in< / span > < span class = "n" > compose_types< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ):< / span >
< span class = "c1" > # Read the kickstart template for this type< / span >
< span class = "n" > ks_template_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "s2" > " .ks" < / span >
< span class = "n" > ks_template< / span > < span class = "o" > =< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > ks_template_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " r" < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > read< / span > < span class = "p" > ()< / span >
< span class = "c1" > # How much space will the packages in the default template take?< / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > ks_template< / span > < span class = "o" > +< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "si" > %e< / span > < span class = "s2" > nd< / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
< span class = "n" > pkgs< / span > < span class = "o" > =< / span > < span class = "p" > [(< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > name< / span > < span class = "ow" > in< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > packages< / span > < span class = "o" > .< / span > < span class = "n" > packageList< / span > < span class = "p" > ]< / span >
< span class = "n" > grps< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "n" > grp< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "k" > for< / span > < span class = "n" > grp< / span > < span class = "ow" > in< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > packages< / span > < span class = "o" > .< / span > < span class = "n" > groupList< / span > < span class = "p" > ]< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
2019-04-17 19:12:11 +00:00
< span class = "n" > projects_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > pkgs< / span > < span class = "p" > ,< / span > < span class = "n" > grps< / span > < span class = "p" > )< / span >
2018-07-20 22:51:06 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > template_errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " Error depsolving < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > compose_type< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "k" > return< / span > < span class = "n" > template_errors< / span > < / div >
2018-05-12 00:18:21 +00:00
< div class = "viewcode-block" id = "repo_to_ks" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.repo_to_ks" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > repo_to_ks< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "p" > ,< / span > < span class = "n" > url< / span > < span class = "o" > =< / span > < span class = "s2" > " url" < / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return a kickstart line with the correct args.< / span >
< span class = "sd" > :param r: DNF repository information< / span >
< span class = "sd" > :type r: dnf.Repo< / span >
< span class = "sd" > :param url: " url" or " baseurl" to use for the baseurl parameter< / span >
< span class = "sd" > :type url: str< / span >
< span class = "sd" > :returns: kickstart command arguments for url/repo command< / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > Set url to " baseurl" if it is a repo, leave it as " url" for the installation url.< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > cmd< / span > < span class = "o" > =< / span > < span class = "s2" > " " < / span >
< span class = "c1" > # url uses --url not --baseurl< / span >
< span class = "k" > if< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --< / span > < span class = "si" > %s< / span > < span class = "s1" > =" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > url< / span > < span class = "p" > ,< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ])< / span >
< span class = "k" > elif< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --metalink=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span >
< span class = "k" > elif< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --mirrorlist=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " Repo has no baseurl, metalink, or mirrorlist" < / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > proxy< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --proxy=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > proxy< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslverify< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --noverifyssl' < / span >
2019-03-27 23:44:14 +00:00
< span class = "k" > if< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslcacert< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --sslcacert=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslcacert< / span >
< span class = "k" > if< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslclientcert< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --sslclientcert=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslclientcert< / span >
< span class = "k" > if< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslclientkey< / span > < span class = "p" > :< / span >
< span class = "n" > cmd< / span > < span class = "o" > +=< / span > < span class = "s1" > ' --sslclientkey=" < / span > < span class = "si" > %s< / span > < span class = "s1" > " ' < / span > < span class = "o" > %< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > sslclientkey< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > return< / span > < span class = "n" > cmd< / span > < / div >
2019-03-27 23:44:14 +00:00
< div class = "viewcode-block" id = "bootloader_append" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.bootloader_append" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > bootloader_append< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > kernel_append< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Insert the kernel_append string into the --append argument< / span >
< span class = "sd" > :param line: The bootloader ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param kernel_append: The arguments to append to the --append section< / span >
< span class = "sd" > :type kernel_append: str< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > bootloader< / span > < span class = "o" > .< / span > < span class = "n" > appendLine< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > bootloader< / span > < span class = "o" > .< / span > < span class = "n" > appendLine< / span > < span class = "o" > +=< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > kernel_append< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > bootloader< / span > < span class = "o" > .< / span > < span class = "n" > appendLine< / span > < span class = "o" > =< / span > < span class = "n" > kernel_append< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the bootloader line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > bootloader< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_kernel_append" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_kernel_append" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_kernel_append< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.kernel append value< / span >
< span class = "sd" > :param recipe:< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: append value or empty string< / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " kernel" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " append" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " kernel" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "s2" > " " < / span >
< span class = "k" > return< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " kernel" < / span > < span class = "p" > ][< / span > < span class = "s2" > " append" < / span > < span class = "p" > ]< / span > < / div >
2019-04-17 19:12:11 +00:00
< div class = "viewcode-block" id = "timezone_cmd" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.timezone_cmd" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > timezone_cmd< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > settings< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Update the timezone line with the settings< / span >
< span class = "sd" > :param line: The timezone ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param settings: A dict with timezone and/or ntpservers list< / span >
< span class = "sd" > :type settings: dict< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "s2" > " timezone" < / span > < span class = "ow" > in< / span > < span class = "n" > settings< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > timezone< / span > < span class = "o" > .< / span > < span class = "n" > timezone< / span > < span class = "o" > =< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " timezone" < / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "s2" > " ntpservers" < / span > < span class = "ow" > in< / span > < span class = "n" > settings< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > timezone< / span > < span class = "o" > .< / span > < span class = "n" > ntpservers< / span > < span class = "o" > =< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " ntpservers" < / span > < span class = "p" > ]< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the timezone line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > timezone< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_timezone_settings" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_timezone_settings" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_timezone_settings< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.timezone dict< / span >
< span class = "sd" > :param recipe:< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: append value or empty string< / span >
< span class = "sd" > :rtype: dict< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " timezone" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "p" > {}< / span >
< span class = "k" > return< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " timezone" < / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "lang_cmd" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.lang_cmd" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > lang_cmd< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > languages< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Update the lang line with the languages< / span >
< span class = "sd" > :param line: The lang ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param settings: The list of languages< / span >
< span class = "sd" > :type settings: list< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > languages< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > lang< / span > < span class = "o" > .< / span > < span class = "n" > lang< / span > < span class = "o" > =< / span > < span class = "n" > languages< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > languages< / span > < span class = "p" > )< / span > < span class = "o" > > < / span > < span class = "mi" > 1< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > lang< / span > < span class = "o" > .< / span > < span class = "n" > addsupport< / span > < span class = "o" > =< / span > < span class = "n" > languages< / span > < span class = "p" > [< / span > < span class = "mi" > 1< / span > < span class = "p" > :]< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the lang line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > lang< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_languages" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_languages" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_languages< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.locale.languages list< / span >
< span class = "sd" > :param recipe: The recipe< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: list of language strings< / span >
< span class = "sd" > :rtype: list< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " locale" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " languages" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " locale" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "p" > []< / span >
< span class = "k" > return< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " locale" < / span > < span class = "p" > ][< / span > < span class = "s2" > " languages" < / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "keyboard_cmd" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.keyboard_cmd" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > keyboard_cmd< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > layout< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Update the keyboard line with the layout< / span >
< span class = "sd" > :param line: The keyboard ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param settings: The keyboard layout< / span >
< span class = "sd" > :type settings: str< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > layout< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > keyboard< / span > < span class = "o" > .< / span > < span class = "n" > keyboard< / span > < span class = "o" > =< / span > < span class = "n" > layout< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > keyboard< / span > < span class = "o" > .< / span > < span class = "n" > vc_keymap< / span > < span class = "o" > =< / span > < span class = "s2" > " " < / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > keyboard< / span > < span class = "o" > .< / span > < span class = "n" > x_layouts< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the keyboard line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > keyboard< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_keyboard_layout" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_keyboard_layout" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_keyboard_layout< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.locale.keyboard list< / span >
< span class = "sd" > :param recipe: The recipe< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: The keyboard layout string< / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " locale" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " keyboard" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " locale" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "p" > []< / span >
< span class = "k" > return< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " locale" < / span > < span class = "p" > ][< / span > < span class = "s2" > " keyboard" < / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "firewall_cmd" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.firewall_cmd" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > firewall_cmd< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > settings< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Update the firewall line with the new ports and services< / span >
< span class = "sd" > :param line: The firewall ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param settings: A dict with the list of services and ports to enable and disable< / span >
< span class = "sd" > :type settings: dict< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "c1" > # Do not override firewall --disabled< / span >
< span class = "k" > if< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > enabled< / span > < span class = "o" > !=< / span > < span class = "kc" > False< / span > < span class = "ow" > and< / span > < span class = "n" > settings< / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > ports< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " ports" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > ports< / span > < span class = "p" > ))< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "p" > ))< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > remove_services< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "o" > .< / span > < span class = "n" > remove_services< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the keyboard line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > firewall< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_firewall_settings" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_firewall_settings" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_firewall_settings< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.firewall settings< / span >
< span class = "sd" > :param recipe: The recipe< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: A dict of settings< / span >
< span class = "sd" > :rtype: dict< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > settings< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s2" > " ports" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > :< / span > < span class = "p" > []}< / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " firewall" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > settings< / span >
< span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " ports" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " firewall" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " ports" < / span > < span class = "p" > ,< / span > < span class = "p" > [])< / span >
< span class = "k" > if< / span > < span class = "s2" > " services" < / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " firewall" < / span > < span class = "p" > ]:< / span >
< span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " firewall" < / span > < span class = "p" > ][< / span > < span class = "s2" > " services" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ,< / span > < span class = "p" > [])< / span >
< span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " firewall" < / span > < span class = "p" > ][< / span > < span class = "s2" > " services" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ,< / span > < span class = "p" > [])< / span >
< span class = "k" > return< / span > < span class = "n" > settings< / span > < / div >
< div class = "viewcode-block" id = "services_cmd" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.services_cmd" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > services_cmd< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > settings< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Update the services line with additional services to enable/disable< / span >
< span class = "sd" > :param line: The services ... line< / span >
< span class = "sd" > :type line: str< / span >
< span class = "sd" > :param settings: A dict with the list of services to enable and disable< / span >
< span class = "sd" > :type settings: dict< / span >
< span class = "sd" > Using pykickstart to process the line is the best way to make sure it< / span >
< span class = "sd" > is parsed correctly, and re-assembled for inclusion into the final kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "c1" > # Empty services and no additional settings, return an empty string< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > line< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "s2" > " " < / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "c1" > # Allow passing in a ' default' so that the enable/disable may be applied to it, without< / span >
< span class = "c1" > # parsing it and emitting a kickstart error message< / span >
< span class = "k" > if< / span > < span class = "n" > line< / span > < span class = "o" > !=< / span > < span class = "s2" > " services" < / span > < span class = "p" > :< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > )< / span >
< span class = "c1" > # Add to any existing services, removing any duplicates< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "o" > .< / span > < span class = "n" > enabled< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "o" > .< / span > < span class = "n" > enabled< / span > < span class = "p" > ))< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "o" > .< / span > < span class = "n" > disabled< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "o" > .< / span > < span class = "n" > disabled< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Converting back to a string includes a comment, return just the keyboard line< / span >
< span class = "k" > return< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > services< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ()[< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "get_services" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_services" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_services< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the customizations.services settings< / span >
< span class = "sd" > :param recipe: The recipe< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: A dict of settings< / span >
< span class = "sd" > :rtype: dict< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > settings< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > :< / span > < span class = "p" > []}< / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "ow" > or< / span > \
< span class = "s2" > " services" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > settings< / span >
< span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " services" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ,< / span > < span class = "p" > []))< / span >
< span class = "n" > settings< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ][< / span > < span class = "s2" > " services" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ,< / span > < span class = "p" > []))< / span >
< span class = "k" > return< / span > < span class = "n" > settings< / span > < / div >
< div class = "viewcode-block" id = "get_default_services" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_default_services" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_default_services< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Get the default string for services, based on recipe< / span >
< span class = "sd" > :param recipe: The recipe< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: string with " services" or " " < / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > When no services have been selected we don' t need to add anything to the kickstart< / span >
< span class = "sd" > so return an empty string. Otherwise return " services" which will be updated with< / span >
< span class = "sd" > the settings.< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > services< / span > < span class = "o" > =< / span > < span class = "n" > get_services< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > services< / span > < span class = "p" > [< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > ]< / span > < span class = "ow" > or< / span > < span class = "n" > services< / span > < span class = "p" > [< / span > < span class = "s2" > " disabled" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "s2" > " services" < / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "s2" > " " < / span > < / div >
2019-03-27 23:44:14 +00:00
< div class = "viewcode-block" id = "customize_ks_template" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.customize_ks_template" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > customize_ks_template< / span > < span class = "p" > (< / span > < span class = "n" > ks_template< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Customize the kickstart template and return it< / span >
< span class = "sd" > :param ks_template: The kickstart template< / span >
< span class = "sd" > :type ks_template: str< / span >
< span class = "sd" > :param recipe:< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
2019-04-17 19:12:11 +00:00
< span class = "sd" > Apply customizations to existing template commands, or add defaults for ones that are< / span >
< span class = "sd" > missing and required.< / span >
2019-03-27 23:44:14 +00:00
< span class = "sd" > Apply customizations.kernel.append to the bootloader argument in the template.< / span >
< span class = "sd" > Add bootloader line if it is missing.< / span >
2019-04-17 19:12:11 +00:00
< span class = "sd" > Add default timezone if needed. It does NOT replace an existing timezone entry< / span >
2019-03-27 23:44:14 +00:00
< span class = "sd" > " " " < / span >
2019-04-17 19:12:11 +00:00
< span class = "c1" > # Commands to be modified [NEW-COMMAND-FUNC, NEW-VALUE, DEFAULT, REPLACE]< / span >
< span class = "c1" > # The function is called with a kickstart command string and the value to replace< / span >
< span class = "c1" > # The value is specific to the command, and is understood by the function< / span >
< span class = "c1" > # The default is a complete kickstart command string, suitable for writing to the template< / span >
< span class = "c1" > # If REPLACE is False it will not change an existing entry only add a missing one< / span >
< span class = "n" > commands< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s2" > " bootloader" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > bootloader_append< / span > < span class = "p" > ,< / span >
< span class = "n" > get_kernel_append< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "s1" > ' bootloader --location=none' < / span > < span class = "p" > ,< / span > < span class = "kc" > True< / span > < span class = "p" > ],< / span >
< span class = "s2" > " timezone" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > timezone_cmd< / span > < span class = "p" > ,< / span >
< span class = "n" > get_timezone_settings< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "s1" > ' timezone UTC' < / span > < span class = "p" > ,< / span > < span class = "kc" > False< / span > < span class = "p" > ],< / span >
< span class = "s2" > " lang" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > lang_cmd< / span > < span class = "p" > ,< / span >
< span class = "n" > get_languages< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "s1" > ' lang en_US.UTF-8' < / span > < span class = "p" > ,< / span > < span class = "kc" > True< / span > < span class = "p" > ],< / span >
< span class = "s2" > " keyboard" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > keyboard_cmd< / span > < span class = "p" > ,< / span >
< span class = "n" > get_keyboard_layout< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "s1" > ' keyboard --xlayouts us --vckeymap us' < / span > < span class = "p" > ,< / span > < span class = "kc" > True< / span > < span class = "p" > ],< / span >
< span class = "s2" > " firewall" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > firewall_cmd< / span > < span class = "p" > ,< / span >
< span class = "n" > get_firewall_settings< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "s1" > ' firewall --enabled' < / span > < span class = "p" > ,< / span > < span class = "kc" > True< / span > < span class = "p" > ],< / span >
< span class = "s2" > " services" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > services_cmd< / span > < span class = "p" > ,< / span >
< span class = "n" > get_services< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span >
< span class = "n" > get_default_services< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > ),< / span > < span class = "kc" > True< / span > < span class = "p" > ]< / span >
< span class = "p" > }< / span >
< span class = "n" > found< / span > < span class = "o" > =< / span > < span class = "p" > {}< / span >
2019-03-27 23:44:14 +00:00
< span class = "n" > output< / span > < span class = "o" > =< / span > < span class = "n" > StringIO< / span > < span class = "p" > ()< / span >
< span class = "k" > for< / span > < span class = "n" > line< / span > < span class = "ow" > in< / span > < span class = "n" > ks_template< / span > < span class = "o" > .< / span > < span class = "n" > splitlines< / span > < span class = "p" > ():< / span >
2019-04-17 19:12:11 +00:00
< span class = "k" > for< / span > < span class = "n" > cmd< / span > < span class = "ow" > in< / span > < span class = "n" > commands< / span > < span class = "p" > :< / span >
< span class = "p" > (< / span > < span class = "n" > new_command< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ,< / span > < span class = "n" > default< / span > < span class = "p" > ,< / span > < span class = "n" > replace< / span > < span class = "p" > )< / span > < span class = "o" > =< / span > < span class = "n" > commands< / span > < span class = "p" > [< / span > < span class = "n" > cmd< / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "n" > line< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "n" > cmd< / span > < span class = "p" > ):< / span >
< span class = "n" > found< / span > < span class = "p" > [< / span > < span class = "n" > cmd< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > if< / span > < span class = "n" > value< / span > < span class = "ow" > and< / span > < span class = "n" > replace< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Replacing < / span > < span class = "si" > %s< / span > < span class = "s2" > with < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > cmd< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > )< / span >
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > new_command< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ),< / span > < span class = "n" > file< / span > < span class = "o" > =< / span > < span class = "n" > output< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Skipping < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > cmd< / span > < span class = "p" > )< / span >
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > file< / span > < span class = "o" > =< / span > < span class = "n" > output< / span > < span class = "p" > )< / span >
< span class = "k" > break< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "c1" > # No matches, write the line as-is< / span >
2019-03-27 23:44:14 +00:00
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > line< / span > < span class = "p" > ,< / span > < span class = "n" > file< / span > < span class = "o" > =< / span > < span class = "n" > output< / span > < span class = "p" > )< / span >
2019-04-17 19:12:11 +00:00
< span class = "c1" > # Write out defaults for the ones not found< / span >
< span class = "c1" > # These must go FIRST because the template still needs to have the packages added< / span >
< span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "n" > StringIO< / span > < span class = "p" > ()< / span >
< span class = "k" > for< / span > < span class = "n" > cmd< / span > < span class = "ow" > in< / span > < span class = "n" > commands< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > cmd< / span > < span class = "ow" > in< / span > < span class = "n" > found< / span > < span class = "p" > :< / span >
2019-03-27 23:44:14 +00:00
< span class = "k" > continue< / span >
2019-04-17 19:12:11 +00:00
< span class = "p" > (< / span > < span class = "n" > new_command< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ,< / span > < span class = "n" > default< / span > < span class = "p" > ,< / span > < span class = "n" > _< / span > < span class = "p" > )< / span > < span class = "o" > =< / span > < span class = "n" > commands< / span > < span class = "p" > [< / span > < span class = "n" > cmd< / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "n" > value< / span > < span class = "ow" > and< / span > < span class = "n" > default< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Setting < / span > < span class = "si" > %s< / span > < span class = "s2" > to use < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > cmd< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > )< / span >
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > new_command< / span > < span class = "p" > (< / span > < span class = "n" > default< / span > < span class = "p" > ,< / span > < span class = "n" > value< / span > < span class = "p" > ),< / span > < span class = "n" > file< / span > < span class = "o" > =< / span > < span class = "n" > defaults< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > default< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Setting < / span > < span class = "si" > %s< / span > < span class = "s2" > to < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > cmd< / span > < span class = "p" > ,< / span > < span class = "n" > default< / span > < span class = "p" > )< / span >
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > default< / span > < span class = "p" > ,< / span > < span class = "n" > file< / span > < span class = "o" > =< / span > < span class = "n" > defaults< / span > < span class = "p" > )< / span >
2019-03-27 23:44:14 +00:00
2019-04-17 19:12:11 +00:00
< span class = "k" > return< / span > < span class = "n" > defaults< / span > < span class = "o" > .< / span > < span class = "n" > getvalue< / span > < span class = "p" > ()< / span > < span class = "o" > +< / span > < span class = "n" > output< / span > < span class = "o" > .< / span > < span class = "n" > getvalue< / span > < span class = "p" > ()< / span > < / div >
2019-03-27 23:44:14 +00:00
2018-10-04 23:55:20 +00:00
< div class = "viewcode-block" id = "write_ks_root" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.write_ks_root" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > write_ks_root< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > user< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Write kickstart root password and sshkey entry< / span >
< span class = "sd" > :param f: kickstart file object< / span >
< span class = "sd" > :type f: open file object< / span >
< span class = "sd" > :param user: A blueprint user dictionary< / span >
< span class = "sd" > :type user: dict< / span >
< span class = "sd" > :returns: True if it wrote a rootpw command to the kickstart< / span >
< span class = "sd" > :rtype: bool< / span >
< span class = "sd" > If the entry contains a ssh key, use sshkey to write it< / span >
< span class = "sd" > If it contains password, use rootpw to set it< / span >
< span class = "sd" > root cannot be used with the user command. So only key and password are supported< / span >
< span class = "sd" > for root.< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > wrote_rootpw< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "c1" > # ssh key uses the sshkey kickstart command< / span >
< span class = "k" > if< / span > < span class = "s2" > " key" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' sshkey --user < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " key" < / span > < span class = "p" > ]))< / span >
< span class = "k" > if< / span > < span class = "s2" > " password" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "nb" > any< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " password" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "n" > prefix< / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > prefix< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " $2b$" < / span > < span class = "p" > ,< / span > < span class = "s2" > " $6$" < / span > < span class = "p" > ,< / span > < span class = "s2" > " $5$" < / span > < span class = "p" > ]):< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Detected pre-crypted password" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' rootpw --iscrypted " < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " password" < / span > < span class = "p" > ])< / span >
< span class = "n" > wrote_rootpw< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Detected plaintext password" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' rootpw --plaintext " < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " password" < / span > < span class = "p" > ])< / span >
< span class = "n" > wrote_rootpw< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > return< / span > < span class = "n" > wrote_rootpw< / span > < / div >
2018-05-12 00:18:21 +00:00
< div class = "viewcode-block" id = "write_ks_user" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.write_ks_user" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > write_ks_user< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > user< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Write kickstart user and sshkey entry< / span >
< span class = "sd" > :param f: kickstart file object< / span >
< span class = "sd" > :type f: open file object< / span >
< span class = "sd" > :param user: A blueprint user dictionary< / span >
< span class = "sd" > :type user: dict< / span >
< span class = "sd" > If the entry contains a ssh key, use sshkey to write it< / span >
< span class = "sd" > All of the user fields are optional, except name, write out a kickstart user entry< / span >
< span class = "sd" > with whatever options are relevant.< / span >
< span class = "sd" > " " " < / span >
< span class = "c1" > # ssh key uses the sshkey kickstart command< / span >
< span class = "k" > if< / span > < span class = "s2" > " key" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' sshkey --user < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " key" < / span > < span class = "p" > ]))< / span >
< span class = "c1" > # Write out the user kickstart command, much of it is optional< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " user --name < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " home" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --homedir < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " home" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " password" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "nb" > any< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " password" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "n" > prefix< / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > prefix< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " $2b$" < / span > < span class = "p" > ,< / span > < span class = "s2" > " $6$" < / span > < span class = "p" > ,< / span > < span class = "s2" > " $5$" < / span > < span class = "p" > ]):< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Detected pre-crypted password" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --iscrypted" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Detected plaintext password" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --plaintext" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --password < / span > < span class = "se" > \" < / span > < span class = "si" > %s< / span > < span class = "se" > \" < / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " password" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " shell" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --shell < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " shell" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " uid" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --uid < / span > < span class = "si" > %d< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " uid" < / span > < span class = "p" > ]))< / span >
< span class = "k" > if< / span > < span class = "s2" > " gid" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --gid < / span > < span class = "si" > %d< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " gid" < / span > < span class = "p" > ]))< / span >
< span class = "k" > if< / span > < span class = "s2" > " description" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --gecos < / span > < span class = "se" > \" < / span > < span class = "si" > %s< / span > < span class = "se" > \" < / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " description" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " groups" < / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --groups < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "s2" > " ," < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " groups" < / span > < span class = "p" > ]))< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "write_ks_group" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.write_ks_group" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > write_ks_group< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > group< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Write kickstart group entry< / span >
< span class = "sd" > :param f: kickstart file object< / span >
< span class = "sd" > :type f: open file object< / span >
< span class = "sd" > :param group: A blueprint group dictionary< / span >
< span class = "sd" > :type user: dict< / span >
< span class = "sd" > gid is optional< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " name" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > group< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " group entry requires a name" < / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " group --name < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > group< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " gid" < / span > < span class = "ow" > in< / span > < span class = "n" > group< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " --gid < / span > < span class = "si" > %d< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > group< / span > < span class = "p" > [< / span > < span class = "s2" > " gid" < / span > < span class = "p" > ]))< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "add_customizations" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.add_customizations" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > add_customizations< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Add customizations to the kickstart file< / span >
< span class = "sd" > :param f: kickstart file object< / span >
< span class = "sd" > :type f: open file object< / span >
< span class = "sd" > :param recipe:< / span >
< span class = "sd" > :type recipe: Recipe object< / span >
< span class = "sd" > :returns: None< / span >
< span class = "sd" > :raises: RuntimeError if there was a problem writing to the kickstart< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "s2" > " customizations" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > recipe< / span > < span class = "p" > :< / span >
2018-10-04 23:55:20 +00:00
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' rootpw --lock< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > return< / span >
< span class = "n" > customizations< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " customizations" < / span > < span class = "p" > ]< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # allow customizations to be incorrectly specified as [[customizations]] instead of [customizations]< / span >
< span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "n" > customizations< / span > < span class = "p" > ,< / span > < span class = "nb" > list< / span > < span class = "p" > ):< / span >
< span class = "n" > customizations< / span > < span class = "o" > =< / span > < span class = "n" > customizations< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > if< / span > < span class = "s2" > " hostname" < / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " network --hostname=< / span > < span class = "si" > %s< / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > customizations< / span > < span class = "p" > [< / span > < span class = "s2" > " hostname" < / span > < span class = "p" > ])< / span >
< span class = "c1" > # TODO - remove this, should use user section to define this< / span >
< span class = "k" > if< / span > < span class = "s2" > " sshkey" < / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > :< / span >
< span class = "c1" > # This is a list of entries< / span >
< span class = "k" > for< / span > < span class = "n" > sshkey< / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > [< / span > < span class = "s2" > " sshkey" < / span > < span class = "p" > ]:< / span >
< span class = "k" > if< / span > < span class = "s2" > " user" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > sshkey< / span > < span class = "ow" > or< / span > < span class = "s2" > " key" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > sshkey< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is incorrect, skipping" < / span > < span class = "p" > ,< / span > < span class = "n" > sshkey< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' sshkey --user < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > sshkey< / span > < span class = "p" > [< / span > < span class = "s2" > " user" < / span > < span class = "p" > ],< / span > < span class = "n" > sshkey< / span > < span class = "p" > [< / span > < span class = "s2" > " key" < / span > < span class = "p" > ]))< / span >
< span class = "c1" > # Creating a user also creates a group. Make a list of the names for later< / span >
< span class = "n" > user_groups< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
2018-10-04 23:55:20 +00:00
< span class = "c1" > # kickstart requires a rootpw line< / span >
< span class = "n" > wrote_rootpw< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > if< / span > < span class = "s2" > " user" < / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > :< / span >
< span class = "c1" > # only name is required, everything else is optional< / span >
< span class = "k" > for< / span > < span class = "n" > user< / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > [< / span > < span class = "s2" > " user" < / span > < span class = "p" > ]:< / span >
2018-10-04 23:55:20 +00:00
< span class = "k" > if< / span > < span class = "s2" > " name" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > user< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " user entry requires a name" < / span > < span class = "p" > )< / span >
< span class = "c1" > # root is special, cannot use normal user command for it< / span >
< span class = "k" > if< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "o" > ==< / span > < span class = "s2" > " root" < / span > < span class = "p" > :< / span >
< span class = "n" > wrote_rootpw< / span > < span class = "o" > =< / span > < span class = "n" > write_ks_root< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > user< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > write_ks_user< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > user< / span > < span class = "p" > )< / span >
< span class = "n" > user_groups< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > user< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "k" > if< / span > < span class = "s2" > " group" < / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > :< / span >
< span class = "k" > for< / span > < span class = "n" > group< / span > < span class = "ow" > in< / span > < span class = "n" > customizations< / span > < span class = "p" > [< / span > < span class = "s2" > " group" < / span > < span class = "p" > ]:< / span >
< span class = "k" > if< / span > < span class = "n" > group< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > user_groups< / span > < span class = "p" > :< / span >
< span class = "n" > write_ks_group< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > group< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
2018-10-04 23:55:20 +00:00
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > warning< / span > < span class = "p" > (< / span > < span class = "s2" > " Skipping group < / span > < span class = "si" > %s< / span > < span class = "s2" > , already created by user" < / span > < span class = "p" > ,< / span > < span class = "n" > group< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "c1" > # Lock the root account if no root user password has been specified< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > wrote_rootpw< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' rootpw --lock< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "p" > )< / span > < / div >
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
< div class = "viewcode-block" id = "get_extra_pkgs" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.get_extra_pkgs" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_extra_pkgs< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return extra packages needed for the output type< / span >
< span class = "sd" > :param dbo: dnf base object< / span >
< span class = "sd" > :type dbo: dnf.Base< / span >
< span class = "sd" > :param share_dir: Path to the top level share directory< / span >
< span class = "sd" > :type share_dir: str< / span >
< span class = "sd" > :param compose_type: The type of output to create from the recipe< / span >
< span class = "sd" > :type compose_type: str< / span >
< span class = "sd" > :returns: List of package names (name only, not NEVRA)< / span >
< span class = "sd" > :rtype: list< / span >
< span class = "sd" > Currently this is only needed by live-iso, it reads ./live/live-install.tmpl and< / span >
< span class = "sd" > processes only the installpkg lines. It lists the packages needed to complete creation of the< / span >
< span class = "sd" > iso using the templates such as x86.tmpl< / span >
< span class = "sd" > Keep in mind that the live-install.tmpl is shared between livemedia-creator and lorax-composer,< / span >
< span class = "sd" > even though the results are applied differently.< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "n" > compose_type< / span > < span class = "o" > !=< / span > < span class = "s2" > " live-iso" < / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "p" > []< / span >
< span class = "c1" > # get the arch information to pass to the runner< / span >
< span class = "n" > arch< / span > < span class = "o" > =< / span > < span class = "n" > ArchData< / span > < span class = "p" > (< / span > < span class = "n" > get_buildarch< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ))< / span >
< span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "n" > DataHolder< / span > < span class = "p" > (< / span > < span class = "n" > basearch< / span > < span class = "o" > =< / span > < span class = "n" > arch< / span > < span class = "o" > .< / span > < span class = "n" > basearch< / span > < span class = "p" > )< / span >
< span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > find_templates< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ),< / span > < span class = "s2" > " live" < / span > < span class = "p" > )< / span >
< span class = "n" > runner< / span > < span class = "o" > =< / span > < span class = "n" > LiveTemplateRunner< / span > < span class = "p" > (< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > templatedir< / span > < span class = "o" > =< / span > < span class = "n" > templatedir< / span > < span class = "p" > ,< / span > < span class = "n" > defaults< / span > < span class = "o" > =< / span > < span class = "n" > defaults< / span > < span class = "p" > )< / span >
< span class = "n" > runner< / span > < span class = "o" > .< / span > < span class = "n" > run< / span > < span class = "p" > (< / span > < span class = "s2" > " live-install.tmpl" < / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " extra pkgs = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > runner< / span > < span class = "o" > .< / span > < span class = "n" > pkgs< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > runner< / span > < span class = "o" > .< / span > < span class = "n" > pkgnames< / span > < / div >
2018-05-12 00:18:21 +00:00
< div class = "viewcode-block" id = "start_build" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.start_build" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > start_build< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > ,< / span > < span class = "n" > dnflock< / span > < span class = "p" > ,< / span > < span class = "n" > gitlock< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > recipe_name< / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > ,< / span > < span class = "n" > test_mode< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Start the build< / span >
< span class = "sd" > :param cfg: Configuration object< / span >
< span class = "sd" > :type cfg: ComposerConfig< / span >
< span class = "sd" > :param dnflock: Lock and YumBase for depsolving< / span >
< span class = "sd" > :type dnflock: YumLock< / span >
< span class = "sd" > :param recipe: The recipe to build< / span >
< span class = "sd" > :type recipe: str< / span >
< span class = "sd" > :param compose_type: The type of output to create from the recipe< / span >
< span class = "sd" > :type compose_type: str< / span >
< span class = "sd" > :returns: Unique ID for the build that can be used to track its status< / span >
< span class = "sd" > :rtype: str< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > share_dir< / span > < span class = "o" > =< / span > < span class = "n" > cfg< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " share_dir" < / span > < span class = "p" > )< / span >
< span class = "n" > lib_dir< / span > < span class = "o" > =< / span > < span class = "n" > cfg< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " lib_dir" < / span > < span class = "p" > )< / span >
< span class = "c1" > # Make sure compose_type is valid< / span >
< span class = "k" > if< / span > < span class = "n" > compose_type< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > compose_types< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ):< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " Invalid compose type (< / span > < span class = "si" > %s< / span > < span class = "s2" > ), must be one of < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > compose_type< / span > < span class = "p" > ,< / span > < span class = "n" > compose_types< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > )))< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Some image types (live-iso) need extra packages for composer to execute the output template< / span >
< span class = "k" > with< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > extra_pkgs< / span > < span class = "o" > =< / span > < span class = "n" > get_extra_pkgs< / span > < span class = "p" > (< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " Extra packages needed for < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > ,< / span > < span class = "n" > extra_pkgs< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > with< / span > < span class = "n" > gitlock< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "p" > (< / span > < span class = "n" > commit_id< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > )< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_and_id< / span > < span class = "p" > (< / span > < span class = "n" > gitlock< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > recipe_name< / span > < span class = "p" > )< / span >
< span class = "c1" > # Combine modules and packages and depsolve the list< / span >
2018-06-04 23:27:56 +00:00
< span class = "n" > module_nver< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "o" > .< / span > < span class = "n" > module_nver< / span >
< span class = "n" > package_nver< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "o" > .< / span > < span class = "n" > package_nver< / span >
2019-03-27 23:44:14 +00:00
< span class = "n" > package_nver< / span > < span class = "o" > .< / span > < span class = "n" > extend< / span > < span class = "p" > ([(< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "s1" > ' *' < / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > name< / span > < span class = "ow" > in< / span > < span class = "n" > extra_pkgs< / span > < span class = "p" > ])< / span >
2018-06-04 23:27:56 +00:00
< span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > module_nver< / span > < span class = "o" > +< / span > < span class = "n" > package_nver< / span > < span class = "p" > ),< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > p< / span > < span class = "p" > :< / span > < span class = "n" > p< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
2019-03-27 23:44:14 +00:00
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " depsolving < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > try< / span > < span class = "p" > :< / span >
2018-10-04 23:55:20 +00:00
< span class = "c1" > # This can possibly update repodata and reset the YumBase object.< / span >
< span class = "k" > with< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > lock_check< / span > < span class = "p" > :< / span >
2018-07-20 22:51:06 +00:00
< span class = "p" > (< / span > < span class = "n" > installed_size< / span > < span class = "p" > ,< / span > < span class = "n" > deps< / span > < span class = "p" > )< / span > < span class = "o" > =< / span > < span class = "n" > projects_depsolve_with_size< / span > < span class = "p" > (< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > projects< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "o" > .< / span > < span class = "n" > group_names< / span > < span class = "p" > ,< / span > < span class = "n" > with_core< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " start_build depsolve: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " Problem depsolving < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "c1" > # Read the kickstart template for this type< / span >
< span class = "n" > ks_template_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "s2" > " .ks" < / span >
< span class = "n" > ks_template< / span > < span class = "o" > =< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > ks_template_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " r" < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > read< / span > < span class = "p" > ()< / span >
< span class = "c1" > # How much space will the packages in the default template take?< / span >
< span class = "n" > ks_version< / span > < span class = "o" > =< / span > < span class = "n" > makeVersion< / span > < span class = "p" > ()< / span >
< span class = "n" > ks< / span > < span class = "o" > =< / span > < span class = "n" > KickstartParser< / span > < span class = "p" > (< / span > < span class = "n" > ks_version< / span > < span class = "p" > ,< / span > < span class = "n" > errorsAreFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > missingIncludeIsFatal< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > readKickstartFromString< / span > < span class = "p" > (< / span > < span class = "n" > ks_template< / span > < span class = "o" > +< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "si" > %e< / span > < span class = "s2" > nd< / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2018-07-20 22:51:06 +00:00
< span class = "n" > pkgs< / span > < span class = "o" > =< / span > < span class = "p" > [(< / span > < span class = "n" > name< / span > < span class = "p" > ,< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > name< / span > < span class = "ow" > in< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > packages< / span > < span class = "o" > .< / span > < span class = "n" > packageList< / span > < span class = "p" > ]< / span >
< span class = "n" > grps< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "n" > grp< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "k" > for< / span > < span class = "n" > grp< / span > < span class = "ow" > in< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > packages< / span > < span class = "o" > .< / span > < span class = "n" > groupList< / span > < span class = "p" > ]< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
2018-07-20 22:51:06 +00:00
< span class = "p" > (< / span > < span class = "n" > template_size< / span > < span class = "p" > ,< / span > < span class = "n" > _< / span > < span class = "p" > )< / span > < span class = "o" > =< / span > < span class = "n" > projects_depsolve_with_size< / span > < span class = "p" > (< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > pkgs< / span > < span class = "p" > ,< / span > < span class = "n" > grps< / span > < span class = "p" > ,< / span > < span class = "n" > with_core< / span > < span class = "o" > =< / span > < span class = "ow" > not< / span > < span class = "n" > ks< / span > < span class = "o" > .< / span > < span class = "n" > handler< / span > < span class = "o" > .< / span > < span class = "n" > packages< / span > < span class = "o" > .< / span > < span class = "n" > nocore< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " start_build depsolve: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " Problem depsolving < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " installed_size = < / span > < span class = "si" > %d< / span > < span class = "s2" > , template_size=< / span > < span class = "si" > %d< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > installed_size< / span > < span class = "p" > ,< / span > < span class = "n" > template_size< / span > < span class = "p" > )< / span >
< span class = "c1" > # Minimum LMC disk size is 1GiB, and anaconda bumps the estimated size up by 10% (which doesn' t always work).< / span >
2019-03-27 23:44:14 +00:00
< span class = "n" > installed_size< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > ((< / span > < span class = "n" > installed_size< / span > < span class = "o" > +< / span > < span class = "n" > template_size< / span > < span class = "p" > ))< / span > < span class = "o" > *< / span > < span class = "mf" > 1.2< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " / partition size = < / span > < span class = "si" > %d< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > installed_size< / span > < span class = "p" > )< / span >
< span class = "c1" > # Create the results directory< / span >
< span class = "n" > build_id< / span > < span class = "o" > =< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > uuid4< / span > < span class = "p" > ())< / span >
< span class = "n" > results_dir< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > lib_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " results" < / span > < span class = "p" > ,< / span > < span class = "n" > build_id< / span > < span class = "p" > )< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > )< / span >
< span class = "c1" > # Write the recipe commit hash< / span >
< span class = "n" > commit_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " COMMIT" < / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > commit_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > commit_id< / span > < span class = "p" > )< / span >
< span class = "c1" > # Write the original recipe< / span >
< span class = "n" > recipe_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " blueprint.toml" < / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > recipe_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "o" > .< / span > < span class = "n" > toml< / span > < span class = "p" > ())< / span >
< span class = "c1" > # Write the frozen recipe< / span >
< span class = "n" > frozen_recipe< / span > < span class = "o" > =< / span > < span class = "n" > recipe< / span > < span class = "o" > .< / span > < span class = "n" > freeze< / span > < span class = "p" > (< / span > < span class = "n" > deps< / span > < span class = "p" > )< / span >
< span class = "n" > recipe_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " frozen.toml" < / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > recipe_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > frozen_recipe< / span > < span class = "o" > .< / span > < span class = "n" > toml< / span > < span class = "p" > ())< / span >
< span class = "c1" > # Write out the dependencies to the results dir< / span >
< span class = "n" > deps_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " deps.toml" < / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > deps_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > toml< / span > < span class = "o" > .< / span > < span class = "n" > dumps< / span > < span class = "p" > ({< / span > < span class = "s2" > " packages" < / span > < span class = "p" > :< / span > < span class = "n" > deps< / span > < span class = "p" > }))< / span >
< span class = "c1" > # Save a copy of the original kickstart< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > copy< / span > < span class = "p" > (< / span > < span class = "n" > ks_template_path< / span > < span class = "p" > ,< / span > < span class = "n" > results_dir< / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > repos< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > dnflock< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ())< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > repos< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " No enabled repos, canceling build." < / span > < span class = "p" > )< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Create the git rpms, if any, and return the path to the repo under results_dir< / span >
< span class = "n" > gitrpm_repo< / span > < span class = "o" > =< / span > < span class = "n" > create_gitrpm_repo< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "c1" > # Create the final kickstart with repos and package list< / span >
< span class = "n" > ks_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " final-kickstart.ks" < / span > < span class = "p" > )< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > ks_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > ks_url< / span > < span class = "o" > =< / span > < span class = "n" > repo_to_ks< / span > < span class = "p" > (< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ],< / span > < span class = "s2" > " url" < / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " url = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > ks_url< / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' url < / span > < span class = "si" > %s< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "n" > ks_url< / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > idx< / span > < span class = "p" > ,< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "nb" > enumerate< / span > < span class = "p" > (< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "mi" > 1< / span > < span class = "p" > :]):< / span >
< span class = "n" > ks_repo< / span > < span class = "o" > =< / span > < span class = "n" > repo_to_ks< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "p" > ,< / span > < span class = "s2" > " baseurl" < / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " repo composer-< / span > < span class = "si" > %s< / span > < span class = "s2" > = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > idx< / span > < span class = "p" > ,< / span > < span class = "n" > ks_repo< / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' repo --name=" composer-< / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "si" > %s< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > idx< / span > < span class = "p" > ,< / span > < span class = "n" > ks_repo< / span > < span class = "p" > ))< / span >
2019-03-27 23:44:14 +00:00
< span class = "k" > if< / span > < span class = "n" > gitrpm_repo< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " repo gitrpms = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > gitrpm_repo< / span > < span class = "p" > )< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' repo --name=" gitrpms" --baseurl=" file://< / span > < span class = "si" > %s< / span > < span class = "s1" > " < / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "n" > gitrpm_repo< / span > < span class = "p" > )< / span >
2018-08-13 23:43:20 +00:00
< span class = "c1" > # Setup the disk for booting< / span >
< span class = "c1" > # TODO Add GPT and UEFI boot support< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' clearpart --all --initlabel< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "c1" > # Write the root partition and it' s size in MB (rounded up)< / span >
2018-10-04 23:55:20 +00:00
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s1" > ' part / --size=< / span > < span class = "si" > %d< / span > < span class = "se" > \n< / span > < span class = "s1" > ' < / span > < span class = "o" > %< / span > < span class = "n" > ceil< / span > < span class = "p" > (< / span > < span class = "n" > installed_size< / span > < span class = "o" > /< / span > < span class = "mi" > 1024< / span > < span class = "o" > **< / span > < span class = "mi" > 2< / span > < span class = "p" > ))< / span >
2018-05-12 00:18:21 +00:00
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Some customizations modify the template before writing it< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > customize_ks_template< / span > < span class = "p" > (< / span > < span class = "n" > ks_template< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > ))< / span >
2018-05-12 00:18:21 +00:00
< span class = "k" > for< / span > < span class = "n" > d< / span > < span class = "ow" > in< / span > < span class = "n" > deps< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > dep_nevra< / span > < span class = "p" > (< / span > < span class = "n" > d< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Include the rpms from the gitrpm repo directory< / span >
< span class = "k" > if< / span > < span class = "n" > gitrpm_repo< / span > < span class = "p" > :< / span >
< span class = "k" > for< / span > < span class = "n" > rpm< / span > < span class = "ow" > in< / span > < span class = "n" > glob< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "n" > gitrpm_repo< / span > < span class = "p" > ,< / span > < span class = "s2" > " *.rpm" < / span > < span class = "p" > )):< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > basename< / span > < span class = "p" > (< / span > < span class = "n" > rpm< / span > < span class = "p" > )[:< / span > < span class = "o" > -< / span > < span class = "mi" > 4< / span > < span class = "p" > ]< / span > < span class = "o" > +< / span > < span class = "s2" > " < / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %e< / span > < span class = "s2" > nd< / span > < span class = "se" > \n< / span > < span class = "s2" > " < / span > < span class = "p" > )< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Other customizations can be appended to the kickstart< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > add_customizations< / span > < span class = "p" > (< / span > < span class = "n" > f< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > )< / span >
< span class = "c1" > # Setup the config to pass to novirt_install< / span >
< span class = "n" > log_dir< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " logs/" < / span > < span class = "p" > )< / span >
< span class = "n" > cfg_args< / span > < span class = "o" > =< / span > < span class = "n" > compose_args< / span > < span class = "p" > (< / span > < span class = "n" > compose_type< / span > < span class = "p" > )< / span >
< span class = "c1" > # Get the title, project, and release version from the host< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > exists< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release" < / span > < span class = "p" > ):< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release is missing, cannot determine product or release version" < / span > < span class = "p" > )< / span >
2018-09-06 17:37:53 +00:00
< span class = "n" > os_release< / span > < span class = "o" > =< / span > < span class = "n" > flatconfig< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release" < / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
2018-09-06 17:37:53 +00:00
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > debug< / span > < span class = "p" > (< / span > < span class = "s2" > " os_release = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > dict< / span > < span class = "p" > (< / span > < span class = "n" > os_release< / span > < span class = "o" > .< / span > < span class = "n" > items< / span > < span class = "p" > ()))< / span >
2018-05-12 00:18:21 +00:00
2018-09-06 17:37:53 +00:00
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " title" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > os_release< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " PRETTY_NAME" < / span > < span class = "p" > ,< / span > < span class = "s2" > " " < / span > < span class = "p" > )< / span >
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " project" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > os_release< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " NAME" < / span > < span class = "p" > ,< / span > < span class = "s2" > " " < / span > < span class = "p" > )< / span >
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " releasever" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > os_release< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " VERSION_ID" < / span > < span class = "p" > ,< / span > < span class = "s2" > " " < / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " volid" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "s2" > " " < / span >
2019-03-27 23:44:14 +00:00
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " extra_boot_args" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > get_kernel_append< / span > < span class = "p" > (< / span > < span class = "n" > recipe< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
2019-04-17 19:12:11 +00:00
< span class = "k" > if< / span > < span class = "s2" > " compression" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > cfg_args< / span > < span class = "p" > :< / span >
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " compression" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "s2" > " xz" < / span >
< span class = "k" > if< / span > < span class = "s2" > " compress_args" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > cfg_args< / span > < span class = "p" > :< / span >
< span class = "n" > cfg_args< / span > < span class = "p" > [< / span > < span class = "s2" > " compress_args" < / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > cfg_args< / span > < span class = "o" > .< / span > < span class = "n" > update< / span > < span class = "p" > ({< / span >
< span class = "s2" > " ks" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "n" > ks_path< / span > < span class = "p" > ],< / span >
< span class = "s2" > " logfile" < / span > < span class = "p" > :< / span > < span class = "n" > log_dir< / span > < span class = "p" > ,< / span >
< span class = "s2" > " timeout" < / span > < span class = "p" > :< / span > < span class = "mi" > 60< / span > < span class = "p" > ,< / span > < span class = "c1" > # 60 minute timeout< / span >
< span class = "p" > })< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " config.toml" < / span > < span class = "p" > ),< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > toml< / span > < span class = "o" > .< / span > < span class = "n" > dumps< / span > < span class = "p" > (< / span > < span class = "n" > cfg_args< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Set the initial status< / span >
< span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " STATUS" < / span > < span class = "p" > ),< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " WAITING" < / span > < span class = "p" > )< / span >
< span class = "c1" > # Set the test mode, if requested< / span >
< span class = "k" > if< / span > < span class = "n" > test_mode< / span > < span class = "o" > > < / span > < span class = "mi" > 0< / span > < span class = "p" > :< / span >
< span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " TEST" < / span > < span class = "p" > ),< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "n" > test_mode< / span > < span class = "p" > )< / span >
2018-08-13 23:43:20 +00:00
< span class = "n" > write_timestamp< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "n" > TS_CREATED< / span > < span class = "p" > )< / span >
2018-05-12 00:18:21 +00:00
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Adding < / span > < span class = "si" > %s< / span > < span class = "s2" > (< / span > < span class = "si" > %s< / span > < span class = "s2" > < / span > < span class = "si" > %s< / span > < span class = "s2" > ) to compose queue" < / span > < span class = "p" > ,< / span > < span class = "n" > build_id< / span > < span class = "p" > ,< / span > < span class = "n" > recipe< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "n" > compose_type< / span > < span class = "p" > )< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > symlink< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > lib_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " queue/new/" < / span > < span class = "p" > ,< / span > < span class = "n" > build_id< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > build_id< / span > < / div >
< span class = "c1" > # Supported output types< / span >
< div class = "viewcode-block" id = "compose_types" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.compose_types" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > compose_types< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ):< / span >
< span class = "sa" > r< / span > < span class = "sd" > " " " Returns a list of the supported output types< / span >
< span class = "sd" > The output types come from the kickstart names in /usr/share/lorax/composer/\*ks< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > return< / span > < span class = "nb" > sorted< / span > < span class = "p" > ([< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > basename< / span > < span class = "p" > (< / span > < span class = "n" > ks< / span > < span class = "p" > )[:< / span > < span class = "o" > -< / span > < span class = "mi" > 3< / span > < span class = "p" > ]< / span > < span class = "k" > for< / span > < span class = "n" > ks< / span > < span class = "ow" > in< / span > < span class = "n" > glob< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " composer/*.ks" < / span > < span class = "p" > ))])< / span > < / div >
< div class = "viewcode-block" id = "compose_args" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.compose_args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > compose_args< / span > < span class = "p" > (< / span > < span class = "n" > compose_type< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Returns the settings to pass to novirt_install for the compose type< / span >
< span class = "sd" > :param compose_type: The type of compose to create, from `compose_types()`< / span >
< span class = "sd" > :type compose_type: str< / span >
< span class = "sd" > This will return a dict of options that match the ArgumentParser options for livemedia-creator.< / span >
< span class = "sd" > These are the ones the define the type of output, it' s filename, etc.< / span >
< span class = "sd" > Other options will be filled in by `make_compose()`< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > _MAP< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s2" > " tar" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "c1" > # False instead of None because of TOML< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "n" > default_image_name< / span > < span class = "p" > (< / span > < span class = "s2" > " xz" < / span > < span class = "p" > ,< / span > < span class = "s2" > " root.tar" < / span > < span class = "p" > ),< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " live-iso" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "c1" > # False instead of None because of TOML< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " live.iso" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " Anaconda" < / span > < span class = "p" > ,< / span > < span class = "c1" > # Live booting may expect this to be ' Anaconda' < / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " iso_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " iso_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " live.iso" < / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " partitioned-disk" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "c1" > # False instead of None because of TOML< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.img" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " qcow2" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " qcow2" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.qcow2" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " ext4-filesystem" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "c1" > # False instead of None because of TOML< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " filesystem.img" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-05-12 00:18:21 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " ami" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.ami" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " vhd" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " vpc" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "s2" > " -o" < / span > < span class = "p" > ,< / span > < span class = "s2" > " subformat=fixed,force_size" < / span > < span class = "p" > ],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.vhd" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " vmdk" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " vmdk" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.vmdk" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-10-04 23:55:20 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
2018-10-24 17:07:32 +00:00
< span class = "s2" > " openstack" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " qcow2" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.qcow2" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " google" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 1024< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "c1" > # False instead of None because of TOML< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.tar.gz" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.raw" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " compression" < / span > < span class = "p" > :< / span > < span class = "s2" > " gzip" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " compress_args" < / span > < span class = "p" > :< / span > < span class = "p" > [< / span > < span class = "s2" > " -9" < / span > < span class = "p" > ],< / span >
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " hyper-v" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " vhdx" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.vhdx" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
< span class = "s2" > " alibaba" < / span > < span class = "p" > :< / span > < span class = "p" > {< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_fsimage" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_appliance" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ami" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_tar_disk" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
2018-10-24 17:07:32 +00:00
< span class = "s2" > " make_pxe_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_ostree_live" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_oci" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " make_vagrant" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " ostree" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_keep_size" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span >
< span class = "s2" > " live_rootfs_size" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " image_size_align" < / span > < span class = "p" > :< / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span >
2018-10-24 17:07:32 +00:00
< span class = "s2" > " image_type" < / span > < span class = "p" > :< / span > < span class = "s2" > " qcow2" < / span > < span class = "p" > ,< / span >
< span class = "s2" > " qemu_args" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span >
< span class = "s2" > " image_name" < / span > < span class = "p" > :< / span > < span class = "s2" > " disk.qcow2" < / span > < span class = "p" > ,< / span >
2019-04-17 19:12:11 +00:00
< span class = "s2" > " tar_disk_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
2018-10-24 17:07:32 +00:00
< span class = "s2" > " fs_label" < / span > < span class = "p" > :< / span > < span class = "s2" > " " < / span > < span class = "p" > ,< / span >
< span class = "s2" > " image_only" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_name" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_template" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "s2" > " app_file" < / span > < span class = "p" > :< / span > < span class = "kc" > None< / span > < span class = "p" > ,< / span >
< span class = "p" > },< / span >
2018-05-12 00:18:21 +00:00
< span class = "p" > }< / span >
< span class = "k" > return< / span > < span class = "n" > _MAP< / span > < span class = "p" > [< / span > < span class = "n" > compose_type< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "move_compose_results" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.compose.move_compose_results" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > move_compose_results< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > ,< / span > < span class = "n" > results_dir< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Move the final image to the results_dir and cleanup the unneeded compose files< / span >
< span class = "sd" > :param cfg: Build configuration< / span >
< span class = "sd" > :type cfg: DataHolder< / span >
< span class = "sd" > :param results_dir: Directory to put the results into< / span >
< span class = "sd" > :type results_dir: str< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " make_tar" < / span > < span class = "p" > ]:< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > move< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " result_dir" < / span > < span class = "p" > ],< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " image_name" < / span > < span class = "p" > ]),< / span > < span class = "n" > results_dir< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " make_iso" < / span > < span class = "p" > ]:< / span >
< span class = "c1" > # Output from live iso is always a boot.iso under images/, move and rename it< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > move< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " result_dir" < / span > < span class = "p" > ],< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " iso_name" < / span > < span class = "p" > ]),< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " image_name" < / span > < span class = "p" > ]))< / span >
< span class = "k" > elif< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " make_disk" < / span > < span class = "p" > ]< / span > < span class = "ow" > or< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " make_fsimage" < / span > < span class = "p" > ]:< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > move< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " result_dir" < / span > < span class = "p" > ],< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " image_name" < / span > < span class = "p" > ]),< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > results_dir< / span > < span class = "p" > ,< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " image_name" < / span > < span class = "p" > ]))< / span >
< span class = "c1" > # Cleanup the compose directory, but only if it looks like a compose directory< / span >
< span class = "k" > if< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > basename< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " result_dir" < / span > < span class = "p" > ])< / span > < span class = "o" > ==< / span > < span class = "s2" > " compose" < / span > < span class = "p" > :< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > rmtree< / span > < span class = "p" > (< / span > < span class = "n" > cfg< / span > < span class = "p" > [< / span > < span class = "s2" > " result_dir" < / span > < span class = "p" > ])< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " Incorrect compose directory, not cleaning up" < / span > < span class = "p" > )< / span > < / div >
< / pre > < / div >
< / div >
< / div >
< footer >
< hr / >
< div role = "contentinfo" >
< p >
2018-11-13 17:53:31 +00:00
© Copyright 2018, Red Hat, Inc.
2018-05-12 00:18:21 +00:00
< / p >
< / div >
Built with < a href = "http://sphinx-doc.org/" > Sphinx< / a > using a < a href = "https://github.com/rtfd/sphinx_rtd_theme" > theme< / a > provided by < a href = "https://readthedocs.org" > Read the Docs< / a > .
< / footer >
< / div >
< / div >
< / section >
< / div >
< script type = "text/javascript" >
jQuery(function () {
2018-06-04 23:27:56 +00:00
SphinxRtdTheme.Navigation.enable(true);
2018-05-12 00:18:21 +00:00
});
2019-03-27 23:44:14 +00:00
< / script >
2018-05-12 00:18:21 +00:00
< / body >
< / html >