Skip to content

Commit

Permalink
Load initial config file with the default values
Browse files Browse the repository at this point in the history
For a full description please read here
eclipse-bluechi#147.
For each of the node types [hirte, agent] hirte
will get the default config from the default
files located in /usr/shar/hirte/{hirte|agent}
into the hashmap and only after that it will
get the custome config that the usr changed

Fixes: eclipse-bluechi#147
Signed-off-by: Artiom Divak <adivak@redhat.com>
  • Loading branch information
ArtiomDivak authored and mwperina committed Mar 10, 2023
1 parent d3c424d commit 47127df
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions config/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ install_data(
'agent/agent.conf',
install_dir : get_option('sysconfdir') / 'hirte'
)

install_data(
'agent/hirte-default.conf',
install_dir : join_paths(get_option('datadir'), 'hirte-agent', 'config')
)

install_data(
'hirte/hirte-default.conf',
install_dir : join_paths(get_option('datadir'), 'hirte-agent', 'config')
)


2 changes: 2 additions & 0 deletions hirte.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ This package contains the node agent.
%{_datadir}/dbus-1/interfaces/org.containers.hirte.Manager.xml
%{_datadir}/dbus-1/interfaces/org.containers.hirte.Monitor.xml
%{_datadir}/dbus-1/interfaces/org.containers.hirte.Node.xml
%{_datadir}/hirte/config/hirte-default.conf
%{_mandir}/man1/hirte.*
%{_mandir}/man1/hirtectl.*
%{_mandir}/man5/hirte.conf.*
Expand All @@ -89,6 +90,7 @@ This package contains the node agent.
%doc README.md
%license LICENSE
%{_bindir}/hirte-agent
%{_datadir}/hirte-agent/config/hirte-default.conf
%{_mandir}/man1/hirte-agent.*
%{_mandir}/man5/hirte-agent.conf.*
%{_sysconfdir}/dbus-1/system.d/org.containers.hirte.Agent.conf
Expand Down
2 changes: 1 addition & 1 deletion src/agent/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ bool agent_parse_config(Agent *agent, const char *configfile) {

result = cfg_load_complete_configuration(
agent->config,
NULL, // TODO: https://github.com/containers/hirte/issues/147
CFG_AGENT_DEFAULT_CONFIG,
CFG_ETC_HIRTE_AGENT_CONF,
NULL); // TODO: https://github.com/containers/hirte/issues/148
if (result != 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/libhirte/common/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ typedef struct config config;

/* Standard configuration file locations
*/
#define CFG_AGENT_DEFAULT_CONFIG "/usr/share/hirte-agent/config/hirte-default.conf"
#define CFG_HIRTE_DEFAULT_CONFIG "/usr/share/hirte/config/hirte-default.conf"
#define CFG_ETC_HIRTE_CONF CONFIG_H_SYSCONFDIR "/hirte/hirte.conf"
#define CFG_ETC_HIRTE_AGENT_CONF CONFIG_H_SYSCONFDIR "/hirte/agent.conf"

Expand Down
2 changes: 1 addition & 1 deletion src/manager/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool manager_parse_config(Manager *manager, const char *configfile) {

result = cfg_load_complete_configuration(
manager->config,
NULL, // TODO: https://github.com/containers/hirte/issues/147
CFG_HIRTE_DEFAULT_CONFIG,
CFG_ETC_HIRTE_CONF,
NULL); // TODO: https://github.com/containers/hirte/issues/148
if (result != 0) {
Expand Down

0 comments on commit 47127df

Please sign in to comment.