1bundle common ha_def 2{ 3 vars: 4 enable_cfengine_enterprise_hub_ha:: 5 "master_hub_location" string => "$(sys.statedir)/master_hub.dat"; 6 "hubs_keys_location" string => "$(sys.workdir)/ppkeys_hubs"; 7 "ppkeys_staging" string => "$(sys.workdir)/ppkeys_staging"; 8 9 #The location of the config file can not be changed! 10 "config_file" string => "$(this.promise_dirname)/ha_info.json"; 11 12 "config" data => readjson("$(config_file)", "4k"); 13 14 "ips" slist => getindices("config"); 15 16 "hub_sha[$(ips)]" 17 string => escape("root-SHA=$(config[$(ips)][sha]).pub"), 18 comment => "We need to construct an intermediary array so that we can 19 extract a combined list of all hub keys."; 20 21 "hub_shas" 22 slist => getvalues("hub_sha"), 23 comment => "We use the list of hub key files for restricting clients access only to those"; 24 25 26 "replication_only_node[$(ips)]" 27 string => "dummy", ifvarclass => strcmp("$(config[$(ips)][is_in_cluster])", "false"); 28 29 "replication_only_nodes" 30 slist => getindices("replication_only_node"); 31 32 33 classes: 34 "ha_replication_only_node" expression => some($(sys.policy_hub), replication_only_nodes); 35 36 37 reports: 38 verbose_mode:: 39 "HA hub $(ips) $(config[$(ips)][sha])"; 40} 41 42 43