3 KOLLA_DEST=/var/lib/kolla/config_files
4 JSON_DEST=/var/lib/etc-data/json-config
6 # For more config file generation, simply define a new SERVICE_DATA_
7 # prefixed variable. The command string is quoted to include config-file
8 # arguments. Note that the variable name following SERVICE_DATA_ will be
9 # the filename the JSON config is written to.
11 # [EXAMPLE]: SERVICE_DATA_<SERVICE_NAME>=(<command> <source> <dest> <owner> <perms>)
13 SERVICE_DATA_NOVA_LIBVIRT=("/usr/sbin/libvirtd" libvirtd.conf /etc/libvirt/libvirtd.conf root 0644)
14 SERVICE_DATA_NOVA_COMPUTE=("/usr/bin/nova-compute" nova.conf /etc/nova/nova.conf nova 0600)
15 SERVICE_DATA_NEUTRON_OPENVSWITCH_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini neutron 0600)
16 SERVICE_DATA_NEUTRON_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ovs_neutron_plugin.ini /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini neutron 0600)
17 SERVICE_DATA_OVS_VSWITCHD=("/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log")
18 SERVICE_DATA_OVS_DBSERVER=("/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log")
20 function create_json_header() {
25 \"command\": \"${command[@]}\","
29 function create_config_file_header() {
30 echo " \"config_files\": ["
33 function create_config_file_block() {
34 local source=$KOLLA_DEST/$1
41 \t \"source\": \"$source\",
42 \t \"dest\": \"$dest\",
43 \t \"owner\": \"$owner\",
44 \t \"perm\": \"$perm\"
48 function add_trailing_comma() {
52 function create_config_file_trailer() {
56 function create_json_trailer() {
60 function create_json_data() {
64 create_json_header "$config_data"
65 create_config_file_header
67 create_config_file_block "$@"
73 create_config_file_trailer
77 function write_json_data() {
80 local service_data=("${!name}")
82 local service_name=${1#SERVICE_DATA_} # chop SERVICE_DATA_ prefix
83 service_name=${service_name//_/-} # switch underscore to dash
84 service_name=${service_name,,} # change to lowercase
86 echo "Creating JSON file ${service_name}"
87 create_json_data "${service_data[@]}" > "$JSON_DEST/$service_name.json"
90 function process_configs() {
91 for service in ${!SERVICE_DATA_*}; do
92 write_json_data "${service}"