diff --git a/data/Debian-family.yaml b/data/Debian-family.yaml index cff64f1..cfaf8e3 100644 --- a/data/Debian-family.yaml +++ b/data/Debian-family.yaml @@ -1,9 +1,9 @@ --- ovn::controller::package_name: 'ovn-host' ovn::controller::service_name: 'ovn-host' -ovn::controller::config_file_path: '/etc/default/ovn-host' -ovn::controller::config_option_name: 'OVN_CTL_OPTS' +ovn::controller::environment_file_path: '/etc/default/ovn-host' +ovn::controller::opts_envvar_name: 'OVN_CTL_OPTS' ovn::northd::package_name: 'ovn-central' ovn::northd::service_name: 'ovn-central' -ovn::northd::config_file_path: '/etc/default/ovn-central' -ovn::northd::config_option_name: 'OVN_CTL_OPTS' +ovn::northd::environment_file_path: '/etc/default/ovn-central' +ovn::northd::opts_envvar_name: 'OVN_CTL_OPTS' diff --git a/data/RedHat-family.yaml b/data/RedHat-family.yaml index 9aa16c4..af1c443 100644 --- a/data/RedHat-family.yaml +++ b/data/RedHat-family.yaml @@ -1,9 +1,9 @@ --- ovn::controller::package_name: 'openvswitch-ovn-host' ovn::controller::service_name: 'ovn-controller' -ovn::controller::config_file_path: '/etc/sysconfig/ovn-controller' -ovn::controller::config_option_name: 'OVN_CONTROLLER_OPTS' +ovn::controller::environment_file_path: '/etc/sysconfig/ovn-controller' +ovn::controller::opts_envvar_name: 'OVN_CONTROLLER_OPTS' ovn::northd::package_name: 'openvswitch-ovn-central' ovn::northd::service_name: 'ovn-northd' -ovn::northd::config_file_path: '/etc/sysconfig/ovn-northd' -ovn::northd::config_option_name: 'OVN_NORTHD_OPTS' +ovn::northd::environment_file_path: '/etc/sysconfig/ovn-northd' +ovn::northd::opts_envvar_name: 'OVN_NORTHD_OPTS' diff --git a/manifests/controller.pp b/manifests/controller.pp index 0367ebe..9901849 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -11,10 +11,10 @@ # [*service_name*] # (required) Name of ovn-controller service. # -# [*config_file_path*] -# (required) File path of the ovn-controller config file +# [*environment_file_path*] +# (required) File path of the ovn-controller environment file # -# [*config_option_name*] +# [*opts_envvar_name*] # (required) Name of the environment variable to customize options to launch # the ovn-controller service. # @@ -142,8 +142,8 @@ class ovn::controller( String[1] $service_name, String[1] $package_name, - Stdlib::Absolutepath $config_file_path, - String[1] $config_option_name, + Stdlib::Absolutepath $environment_file_path, + String[1] $opts_envvar_name, String $ovn_remote, String $ovn_encap_ip, String $package_ensure = 'present', @@ -213,8 +213,8 @@ class ovn::controller( $ovn_controller_opts = join($ovn_controller_ssl_opts + $ovn_controller_extra_opts, ' ') augeas { 'config-ovn-controller': - context => "/files${config_file_path}", - changes => "set ${config_option_name} '\"${ovn_controller_opts}\"'", + context => "/files${environment_file_path}", + changes => "set ${opts_envvar_name} '\"${ovn_controller_opts}\"'", require => Package['ovn-controller'], notify => Service['controller'], } diff --git a/manifests/northd.pp b/manifests/northd.pp index a7c6a04..29f0764 100644 --- a/manifests/northd.pp +++ b/manifests/northd.pp @@ -9,10 +9,10 @@ # [*service_name*] # (required) Name of ovn-northd service. # -# [*config_file_path*] -# (required) File path of the ovn-controller config file +# [*environment_file_path*] +# (required) File path of the ovn-controller environment file # -# [*config_option_name*] +# [*opts_envvar_name*] # (required) Name of the environment variable to customize options to launch # the ovn-controller service. # @@ -83,8 +83,8 @@ class ovn::northd( String[1] $package_name, String[1] $service_name, - Stdlib::Absolutepath $config_file_path, - String[1] $config_option_name, + Stdlib::Absolutepath $environment_file_path, + String[1] $opts_envvar_name, String $package_ensure = 'present', String $dbs_listen_ip = '0.0.0.0', Optional[String] $dbs_cluster_local_addr = undef, @@ -228,8 +228,8 @@ class ovn::northd( ' ') augeas { 'config-ovn-northd': - context => "/files${config_file_path}", - changes => "set ${config_option_name} '\"${ovn_northd_opts}\"'", + context => "/files${environment_file_path}", + changes => "set ${opts_envvar_name} '\"${ovn_northd_opts}\"'", require => Package['ovn-northd'], before => Service['northd'], } diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index c80d471..1a0f7aa 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -33,7 +33,7 @@ describe 'ovn::controller' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-controller').with({ :context => platform_params[:ovn_controller_context], - :changes => "set " + platform_params[:ovn_controller_option_name] + " '\"\"'", + :changes => "set " + platform_params[:ovn_controller_opts_envvar_name] + " '\"\"'", }) end @@ -243,7 +243,7 @@ describe 'ovn::controller' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-controller').with({ :context => platform_params[:ovn_controller_context], - :changes => "set " + platform_params[:ovn_controller_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_controller_opts_envvar_name] + " '\"" + "--ovn-controller-ssl-key=/path/to/key.pem --ovn-controller-ssl-cert=/path/to/cert.pem --ovn-controller-ssl-ca-cert=/path/to/cacert.pem" + "\"'", }) @@ -263,20 +263,20 @@ describe 'ovn::controller' do when 'Debian' let :platform_params do { - :ovn_controller_package_name => 'ovn-host', - :ovn_controller_service_name => 'ovn-host', - :ovn_controller_context => '/files/etc/default/ovn-host', - :ovn_controller_option_name => 'OVN_CTL_OPTS' + :ovn_controller_package_name => 'ovn-host', + :ovn_controller_service_name => 'ovn-host', + :ovn_controller_context => '/files/etc/default/ovn-host', + :ovn_controller_opts_envvar_name => 'OVN_CTL_OPTS' } end it_behaves_like 'ovn controller' when 'RedHat' let :platform_params do { - :ovn_controller_package_name => 'openvswitch-ovn-host', - :ovn_controller_service_name => 'ovn-controller', - :ovn_controller_context => '/files/etc/sysconfig/ovn-controller', - :ovn_controller_option_name => 'OVN_CONTROLLER_OPTS' + :ovn_controller_package_name => 'openvswitch-ovn-host', + :ovn_controller_service_name => 'ovn-controller', + :ovn_controller_context => '/files/etc/sysconfig/ovn-controller', + :ovn_controller_opts_envvar_name => 'OVN_CONTROLLER_OPTS' } end it_behaves_like 'ovn controller' diff --git a/spec/classes/ovn_northd_spec.rb b/spec/classes/ovn_northd_spec.rb index 16ecc8d..ec4e7dd 100644 --- a/spec/classes/ovn_northd_spec.rb +++ b/spec/classes/ovn_northd_spec.rb @@ -10,7 +10,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0" + " --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes" + "\"'", @@ -31,7 +31,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"--db-nb-addr=[::1] --db-sb-addr=[::1] --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes\"'", }) end @@ -51,7 +51,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0" + " --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes" + " --ovn-northd-nb-db=ssl:192.0.2.1:6645,ssl:192.0.2.2:6645,ssl:192.0.2.3:6645" + @@ -78,7 +78,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0" + " --db-nb-create-insecure-remote=no --db-sb-create-insecure-remote=yes" + " --ovn-nb-db-ssl-key=/path/to/dbkey.pem --ovn-nb-db-ssl-cert=/path/to/dbcert.pem --ovn-nb-db-ssl-ca-cert=/path/to/dbcacert.pem" + @@ -110,7 +110,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=[::1] --db-sb-addr=[::1]" + " --db-nb-create-insecure-remote=no --db-sb-create-insecure-remote=yes" + " --ovn-nb-db-ssl-key=/path/to/dbkey.pem --ovn-nb-db-ssl-cert=/path/to/dbcert.pem --ovn-nb-db-ssl-ca-cert=/path/to/dbcacert.pem" + @@ -141,7 +141,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0" + " --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=no" + " --ovn-sb-db-ssl-key=/path/to/dbkey.pem --ovn-sb-db-ssl-cert=/path/to/dbcert.pem --ovn-sb-db-ssl-ca-cert=/path/to/dbcacert.pem" + @@ -173,7 +173,7 @@ describe 'ovn::northd' do it 'creates systemd conf' do is_expected.to contain_augeas('config-ovn-northd').with({ :context => platform_params[:ovn_northd_context], - :changes => "set " + platform_params[:ovn_northd_option_name] + " '\"" + + :changes => "set " + platform_params[:ovn_northd_opts_envvar_name] + " '\"" + "--db-nb-addr=[::1] --db-sb-addr=[::1]" + " --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=no" + " --ovn-sb-db-ssl-key=/path/to/dbkey.pem --ovn-sb-db-ssl-cert=/path/to/dbcert.pem --ovn-sb-db-ssl-ca-cert=/path/to/dbcacert.pem" + @@ -253,10 +253,10 @@ describe 'ovn::northd' do when 'Debian' let(:platform_params) do { - :ovn_northd_package_name => 'ovn-central', - :ovn_northd_service_name => 'ovn-central', - :ovn_northd_context => '/files/etc/default/ovn-central', - :ovn_northd_option_name => 'OVN_CTL_OPTS' + :ovn_northd_package_name => 'ovn-central', + :ovn_northd_service_name => 'ovn-central', + :ovn_northd_context => '/files/etc/default/ovn-central', + :ovn_northd_opts_envvar_name => 'OVN_CTL_OPTS' } end it_behaves_like 'ovn northd' @@ -264,10 +264,10 @@ describe 'ovn::northd' do when 'RedHat' let(:platform_params) do { - :ovn_northd_package_name => 'openvswitch-ovn-central', - :ovn_northd_service_name => 'ovn-northd', - :ovn_northd_context => '/files/etc/sysconfig/ovn-northd', - :ovn_northd_option_name => 'OVN_NORTHD_OPTS' + :ovn_northd_package_name => 'openvswitch-ovn-central', + :ovn_northd_service_name => 'ovn-northd', + :ovn_northd_context => '/files/etc/sysconfig/ovn-northd', + :ovn_northd_opts_envvar_name => 'OVN_NORTHD_OPTS' } end it_behaves_like 'ovn northd'