-
Notifications
You must be signed in to change notification settings - Fork 186
Salt formulas integration
All folders in /srv/formula_metadata/
and /usr/share/susemanager/formulas/metadata/
that have a form.yml
file inside get detected as formulas and can be applied to groups and systems.
When the page for a formula is requested, the server loads the form.yml
, parses it to JSON
and sends it to the client. The form is then generated in JavaScript. The edited values then get send back to the server and saved. All formula data is stored in the /srv/susemanager/formula_data/
directory:
- Which formula is applied to which group and server is stored in the
group_formulas.json
andserver_formulas.json
files. - The form/pillar values are stored in
group_pillar/<group-id>_<formula-name>.json
for groups andpillar/<minion-id>_<formula-name>.json
for systems.
When the pillar data is generated (e.g. for applying the highstate) the external pillar script (/usr/share/susemanager/modules/pillar/suma_minion.py
), that also generates pillar data for packages, group ids, etc., includes all the pillar data for the system:
It first finds all formulas for this system (by looking in group_formulas.json
and server_formulas.json
).
Then it loads the values for each formula (from the corresponding group, if any and the system) and merges them (defaults if no values found, group overrides system if $scope: group
etc.).
It also includes the list of formulas applied to the system in a pillar named formulas
. This makes it possible to include the states:
The top file (in this case generated by the mgr_master_tops.py
script) includes a state called formulas
for every system. This includes the formulas.sls
file in /usr/share/susemanager/formulas/states/
. The file looks like this:
include: {{ pillar["formulas"] }}
It includes all formulas, that got specified in the pillar data from the external pillar script.
For more information about how Salt Formulas for SUSE Manager should be used, written or packaged see the formulas repository and its documentation.
- Formula installation progress: Display more information about the current installation progress and if the formula is currently active on a system. See this PR.
- Allow automatic insertion of information. For example a user could maybe add a
$insertData: ip
tag and the server would automatically insert the ip adress of the minion into the form field. This could either be done when the form data is send to the client and/or when the formula is applied or there could be a button that requests the information from the server and inserts it into the field. This also doesn't need to be data from the server. Simpler things like the current time or date could even be done directly on the client. - The formula catalog could show a little bit more information about the formula. It could at least display the formula metadata from
metadata.yml
. It would also be cool to install new formulas from there, that then get installed via RPM. - Add a form field type that allows you to a custom template for which the user then can add multiple entries and edit them. Example form.yml:
users:
$type: custom-elements # or custom-group or something like that
$template:
name:
$default: root
password:
$type: password
The user should then have a button to add a new users that will then be created by the formula.
These should all be done after a normal SUSE Manager installation, but just in case the susemanager-sls.spec
file or something else doesn't work correctly:
- external pillar script (
suma_minion.py
) needs to include formula data - data gets saved to
/srv/susemanager/formula_data
and thepillar
andgroup_pillar
sub-directories. they should get generated when needed by the server. -
formulas
must be included for every minion in the top file. this is currently done by themgr_master_tops.py
script. this then includes theformulas.sls
file in /usr/share/susemanager/formulas/states/, which then includes all formulas specified in the pillar. for this the directory has to be a salt file root. that should be configured in the salt master
susemanager.conf`