can set etc to a different location

This commit is contained in:
Tobias Herre 2023-11-03 08:55:37 +01:00
parent 6ecad2c411
commit b6bb057652
1 changed files with 21 additions and 13 deletions

View File

@ -284,7 +284,7 @@ reports:
} }
bundle agent install_sympa_domain(domain,data) bundle agent install_sympa_domain(domain,data,conf_dir)
{ {
vars: vars:
"default_settings" data => '{ "default_settings" data => '{
@ -297,16 +297,16 @@ vars:
"settings[domain]" string => "$(domain)"; "settings[domain]" string => "$(domain)";
files: files:
"$(sympa.conf_dir)/$(domain)/." "$(conf_dir)/$(domain)/."
create => "true", create => "true",
perms => m("755"); perms => m("755");
"$(sympa.conf_dir)/$(domain)/robot.conf" "$(conf_dir)/$(domain)/robot.conf"
perms => m("644"), perms => m("644"),
copy_from => seed_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/robot.conf"), copy_from => seed_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/sympa/robot.conf"),
handle => "sympa_robot_$(domain)_ready"; handle => "sympa_robot_$(domain)_ready";
"$(sympa.conf_dir)/$(domain)/robot.conf" "$(conf_dir)/$(domain)/robot.conf"
create => "true", create => "true",
perms => m("644"), #"sympa","sympa"), perms => m("644"), #"sympa","sympa"),
edit_line => set_config_values("$(this.bundle).settings"), edit_line => set_config_values("$(this.bundle).settings"),
@ -321,12 +321,12 @@ reports:
# "JO: $(jo)"; # "JO: $(jo)";
} }
bundle agent install_sympa_domains(dl) bundle agent install_sympa_domains(dl,conf_dir)
{ {
vars: vars:
"idx" slist => getindices(@(dl)); "idx" slist => getindices(@(dl));
methods: methods:
"any" usebundle => install_sympa_domain("$(idx)",@(dl[$(idx)])); "any" usebundle => install_sympa_domain("$(idx)",@(dl[$(idx)]),"$(conf_dir)");
reports: reports:
} }
@ -346,10 +346,18 @@ files:
bundle agent install_sympa(cfg) bundle agent install_sympa(cfg)
{ {
classes:
"etc_changed" expression => isvariable("cfg[settings][etc]");
vars: vars:
# "cfg_domains" data => @(cfg[domains]);
"domains_idx" slist => getindices(@(cfg[domains])); "domains_idx" slist => getindices(@(cfg[domains]));
# "cfg_domains" slist => {"a","b","c"};
etc_changed::
"cfg_dir" string => "$(cfg[settings][etc])";
!etc_changed::
"cfg_dir" string => "$(sympa.conf_dir)";
methods: methods:
"any" usebundle => sympa_create_mailname(@(cfg)); "any" usebundle => sympa_create_mailname(@(cfg));
"any" usebundle => wmde_install_packages(@(sympa.pkgs),"sympa"); "any" usebundle => wmde_install_packages(@(sympa.pkgs),"sympa");
@ -359,7 +367,8 @@ methods:
"any" usebundle => wmde_service("$(sympa.service_name)","sympa_kept","sympa_repaired"), "any" usebundle => wmde_service("$(sympa.service_name)","sympa_kept","sympa_repaired"),
depends_on => { depends_on => {
"sympa_pkgs_installed", "sympa_pkgs_installed",
"sympa_config_updated" "sympa_config_updated",
"sympa_robots_created"
}; };
"any" usebundle => wmde_service("$(sympa.wwservice_name)","sympa_kept","sympa_repaired"), "any" usebundle => wmde_service("$(sympa.wwservice_name)","sympa_kept","sympa_repaired"),
depends_on => { depends_on => {
@ -368,11 +377,10 @@ methods:
"sympa_robots_created" "sympa_robots_created"
}; };
# "any" usebundle => install_sympa_domain("@(cfg[domains][$(domains_idx)])"); "any" usebundle => install_sympa_domains(@(cfg[domains]),"$(cfg_dir)");
"any" usebundle => install_sympa_domains(@(cfg[domains]));
reports: reports:
# "IDX $(domains_idx)"; "ETC: $(cfg_dir) - $(cfg[settings][etc])";
# "DOMCONF: $(cfg[$(idx)])";
} }