<commit_before>#
# Cookbook Name:: cfgm
# Recipe:: contrail-cfgm
#
# Copyright 2014, Juniper Networks
#

package "contrail-openstack-config" do
    action :upgrade
    notifies :stop, "service[supervisor-config]", :immediately
end

%w{ ifmap-server
    contrail-config
    contrail-utils
    rabbitmq-server
}.each do |pkg|
    package pkg do
        action :upgrade
    end
end

if not platform?("ubuntu") then
    %w{ contrail-api
        contrail-database
        contrail-device-manager
        contrail-discovery
        contrail-schema
        contrail-svc-monitor
    }.each do |svc|
        file "/etc/init.d/#{svc}" do
            owner 'root'
            group 'root'
            mode '0755'
        end
    end
end

template "/etc/rabbitmq/rabbitmq-env.conf" do
    source "rabbitmq-env.conf.erb"
    mode 0644
end

template "/etc/rabbitmq/rabbitmq.config" do
    source "rabbitmq.config.erb"
    mode 00644
    notifies :restart, "service[supervisor-support-service]", :delayed
end

template "/etc/ifmap-server/ifmap.properties" do
    source "ifmap.properties.erb"
    mode 00644
    notifies :restart, "service[ifmap]", :delayed
end

template "/etc/ifmap-server/basicauthusers.properties" do
    source "ifmap-basicauthusers.properties.erb"
    mode 00644
    variables(:servers => get_cfgm_nodes)
    notifies :restart, "service[ifmap]", :immediately
end

template "/etc/contrail/vnc_api_lib.ini" do
    source "contrail-vnc_api_lib.ini.erb"
    owner "contrail"
    group "contrail"
    mode 00644
end

%w{ contrail-discovery
    contrail-svc-monitor
    contrail-api
    contrail-schema
}.each do |pkg|
    template "/etc/contrail/#{pkg}.conf" do
        source "#{pkg}.conf.erb"
        owner "contrail"
        group "contrail"
        mode 00640
        variables(:servers => get_database_nodes)<commit_msg>restat api-server when ifmap config changes<commit_after>#
# Cookbook Name:: cfgm
# Recipe:: contrail-cfgm
#
# Copyright 2014, Juniper Networks
#

package "contrail-openstack-config" do
    action :upgrade
    notifies :stop, "service[supervisor-config]", :immediately
end

%w{ ifmap-server
    contrail-config
    contrail-utils
    rabbitmq-server
}.each do |pkg|
    package pkg do
        action :upgrade
    end
end

if not platform?("ubuntu") then
    %w{ contrail-api
        contrail-database
        contrail-device-manager
        contrail-discovery
        contrail-schema
        contrail-svc-monitor
    }.each do |svc|
        file "/etc/init.d/#{svc}" do
            owner 'root'
            group 'root'
            mode '0755'
        end
    end
end

template "/etc/rabbitmq/rabbitmq-env.conf" do
    source "rabbitmq-env.conf.erb"
    mode 0644
end

template "/etc/rabbitmq/rabbitmq.config" do
    source "rabbitmq.config.erb"
    mode 00644
    notifies :restart, "service[supervisor-support-service]", :delayed
end

template "/etc/ifmap-server/ifmap.properties" do
    source "ifmap.properties.erb"
    mode 00644
    notifies :restart, "service[ifmap]", :immediately
    notifies :restart, "service[contrail-api]", :immediately
end

template "/etc/ifmap-server/basicauthusers.properties" do
    source "ifmap-basicauthusers.properties.erb"
    mode 00644
    variables(:servers => get_cfgm_nodes)
    #notifies :restart, "service[ifmap]", :immediately
end

template "/etc/contrail/vnc_api_lib.ini" do
    source "contrail-vnc_api_lib.ini.erb"
    owner "contrail"
    group "contrail"
    mode 00644
end

%w{ contrail-discovery
    contrail-svc-monitor
    contrail-api
    contrail-schema
}.each do |pkg|
    template "/etc/contrail/#{pkg}.conf" do
        source "#{pkg}.conf.erb"
        owner "contrail"
        group "contrail"
        mode 00640
        variables(:servers => get_database_nodes)
{'fraction_non_alphanumeric': 0.11013333333333333, 'fraction_numerical': 0.019733333333333332, 'mean_word_length': 2.7888888888888888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2535963', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1242, 'n_words': 288}