Closed tzz closed 9 years ago
OK, changed to be just an installer. @kacfengine I will figure out why list-installed
is not working properly.
Yeah, found it. Version
and Architecture
are required in list-installed
responses. I don't think that's a necessary requirement, but I've adapted regardless.
Yes, a lot of assumptions will break if it's not included. Architecture can be a constant string if it's not meaningful though, like "all".
OK, the following example works:
nonesuch
invalid) and set classes if it workedbody file control
{
inputs => { "$(sys.libdir)/stdlib.cf"} ;
}
bundle agent main
{
methods:
# clear all DC data
"" usebundle => file_make("$(sys.masterdir)/sketches/meta/vardata.conf", '
{
"compositions": {},
"activations": {},
"definitions": {},
"environments": {},
"validations": {}
}');
"" usebundle => install_sketches;
Primitives__files_existence_ok::
"" usebundle => activate_sketches;
any::
"" usebundle => uninstall_sketches;
}
bundle agent install_sketches
{
packages:
"Primitives::files_existence"
policy => "present",
package_module => design_center,
classes => scoped_classes_generic("namespace", "Primitives__files_existence");
"nonesuch"
policy => "present",
package_module => design_center;
}
bundle agent uninstall_sketches
{
packages:
"nonesuch"
policy => "absent",
package_module => design_center;
"Primitives::files_existence"
policy => "absent",
package_module => design_center;
}
body package_module design_center
{
default_options => {
'installsource=/home/tzz/source/cfengine/design-center/sketches/cfsketches.json',
'verbose=0',
'veryverbose=0'
};
}
bundle agent activate_sketches
{
vars:
"cfsketch" string => "/home/tzz/source/cfengine/design-center/tools/cf-sketch/cf-sketch.pl";
"params1" data => '{
"list_of_files": [ "/tmp/t1" ],
"success_class": "files_found1",
"fail_class": "files_not_found1"
}';
"pstring1" string => format('%S', params1);
"params2" data => '{
"list_of_files": [ "/tmp/t2" ],
"success_class": "files_found2",
"fail_class": "files_not_found2"
}';
"pstring2" string => format('%S', params2);
commands:
"$(cfsketch) --expert --relocate_path sketches --generate --activate Primitives::files_existence='$(pstring1)'";
"$(cfsketch) --expert --relocate_path sketches --generate --activate Primitives::files_existence='$(pstring2)'";
}
@nickanderson The body package_module design_center
could go into the stdlib if the installsource
is set correctly for Enterprise and Community, but it also needs manual setup from the user to link cf-sketch.pl
to design_center
.
@nickanderson @estenberg can you please consider merging this?
ping?
ping?
Sorry, Design Center really isn't my area. @nickanderson or @estenberg?
What impact if any does this have on Mission Portal and how sketches are installed today?
This has no effect on MP. It is only usable from policy while MP uses the DC API directly.
@estenberg OK to merge this?
ping again!
Thank you for this and all the other help.
See https://dev.cfengine.com/issues/6404
This requires linking
cf-sketch.pl
to the package module directory asdesign_center
.Then the following will install a sketch.