Merge "Add installtype support to package-installs"
This commit is contained in:
commit
6665274553
@ -10,6 +10,8 @@ example package-installs.yaml::
|
||||
phase: pre-install.d
|
||||
networkmanager:
|
||||
uninstall: True
|
||||
os-collect-config:
|
||||
installtype: source
|
||||
|
||||
example package-installs.json::
|
||||
|
||||
@ -17,14 +19,20 @@ example package-installs.json::
|
||||
"libxml2": null,
|
||||
"grub2": {"phase": "pre-install.d"},
|
||||
"networkmanager": {"uninstall": true}
|
||||
"os-collect-config": {"installtype": "source"}
|
||||
}
|
||||
|
||||
|
||||
Setting phase or uninstall properties for a package overrides the following
|
||||
default values::
|
||||
Setting phase, uninstall, or installtype properties for a package overrides
|
||||
the following default values::
|
||||
|
||||
phase: install.d
|
||||
uninstall: False
|
||||
installtype: * (Install package for all installtypes)
|
||||
|
||||
Setting the installtype property causes the package only to be installed if
|
||||
the specified installtype would be used for the element. See the
|
||||
diskimage-builder docs for more information on installtypes.
|
||||
|
||||
|
||||
DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
|
||||
|
@ -23,6 +23,12 @@ import os
|
||||
import yaml
|
||||
|
||||
|
||||
def get_element_installtype(element_name):
|
||||
default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source")
|
||||
element_name.replace('-', '_')
|
||||
return os.environ.get("DIB_INSTALLTYPE_%s" % element_name, default)
|
||||
|
||||
|
||||
def collect_data(data, filename, element_name):
|
||||
try:
|
||||
objs = json.load(open(filename))
|
||||
@ -36,7 +42,11 @@ def collect_data(data, filename, element_name):
|
||||
if 'uninstall' in params:
|
||||
install = "uninstall"
|
||||
|
||||
data[phase][install].append((pkg_name, element_name))
|
||||
# Filter out incorrect installtypes
|
||||
installtype = params.get('installtype', None)
|
||||
elem_installtype = get_element_installtype(element_name)
|
||||
if installtype is None or installtype == elem_installtype:
|
||||
data[phase][install].append((pkg_name, element_name))
|
||||
return data
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user