diff --git a/REFERENCE.md b/REFERENCE.md index cb7bb016b..82c2de48a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -46,7 +46,6 @@ The following parameters are available in the `ntp` class: * [`config_dir`](#-ntp--config_dir) * [`config_epp`](#-ntp--config_epp) * [`config_file_mode`](#-ntp--config_file_mode) -* [`config_template`](#-ntp--config_template) * [`daemon_extra_opts`](#-ntp--daemon_extra_opts) * [`disable_auth`](#-ntp--disable_auth) * [`disable_dhclient`](#-ntp--disable_dhclient) @@ -145,7 +144,7 @@ Specifies a directory for the NTP configuration files. Default value: undef. Data type: `Optional[String]` Specifies an absolute or relative file path to an EPP template for the config file. -Example value: 'ntp/ntp.conf.epp'. A validation error is thrown if both this **and** the `config_template` parameter are specified. +Example value: 'ntp/ntp.conf.epp'. A validation error is thrown if `config_epp` parameter is not specified. ##### `config_file_mode` @@ -153,13 +152,6 @@ Data type: `String` Specifies a file mode for the ntp configuration file. Default value: '0664'. -##### `config_template` - -Data type: `Optional[String]` - -Specifies an absolute or relative file path to an ERB template for the config file. -Example value: 'ntp/ntp.conf.erb'. A validation error is thrown if both this **and** the `config_epp` parameter are specified. - ##### `daemon_extra_opts` Data type: `Optional[String]` diff --git a/data/common.yaml b/data/common.yaml index db1cb5151..20762e80f 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -5,7 +5,6 @@ ntp::burst: false ntp::config_dir: ~ ntp::config_file_mode: '0644' ntp::config: '/etc/ntp.conf' -ntp::config_template: ~ ntp::config_epp: ~ ntp::daemon_extra_opts: ~ ntp::disable_auth: false diff --git a/manifests/config.pp b/manifests/config.pp index 5b8691afa..a3554cfa9 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -90,13 +90,7 @@ } } - #If both epp and erb are defined, throw validation error. - #Otherwise use the defined erb/epp template, or use default - if $ntp::config_epp and $ntp::config_template { - fail('Cannot supply both config_epp and config_template templates for ntp config file.') - } elsif $ntp::config_template { - $config_content = template($ntp::config_template) - } elsif $ntp::config_epp { + if $ntp::config_epp { $config_content = epp($ntp::config_epp) } else { $config_content = epp('ntp/ntp.conf.epp') diff --git a/manifests/init.pp b/manifests/init.pp index 2fc853ea4..8717d5f54 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,15 +19,11 @@ # # @param config_epp # Specifies an absolute or relative file path to an EPP template for the config file. -# Example value: 'ntp/ntp.conf.epp'. A validation error is thrown if both this **and** the `config_template` parameter are specified. +# Example value: 'ntp/ntp.conf.epp'. A validation error is thrown if `config_epp` parameter is not specified. # # @param config_file_mode # Specifies a file mode for the ntp configuration file. Default value: '0664'. # -# @param config_template -# Specifies an absolute or relative file path to an ERB template for the config file. -# Example value: 'ntp/ntp.conf.erb'. A validation error is thrown if both this **and** the `config_epp` parameter are specified. -# # @param daemon_extra_opts # Specifies any arguments to pass to ntp daemon. Default value: '-g'. # Example value: '-g -i /var/lib/ntp' to enable jaildir options. @@ -234,7 +230,8 @@ # # @param user # Specifies user to run ntpd daemon. Default value: ntp. -# Usually set by default on Centos7 (/etc/systemd/system/multi-user.target.wants/ntpd.service) and ubuntu 18.04 (/usr/lib/ntp/ntp-systemd-wrapper) +# Usually set by default on Centos7 (/etc/systemd/system/multi-user.target.wants/ntpd.service) and +# ubuntu 18.04 (/usr/lib/ntp/ntp-systemd-wrapper) # This is currently restricted to Redhat based systems of version 7 and above and Ubuntu 18.04. # class ntp ( @@ -244,7 +241,6 @@ Optional[Stdlib::Absolutepath] $config_dir, String $config_file_mode, Optional[String] $config_epp, - Optional[String] $config_template, Boolean $disable_auth, Boolean $disable_dhclient, Boolean $disable_kernel, diff --git a/readmes/README_ja_JP.md b/readmes/README_ja_JP.md index 9b84d60b5..e4e86ed65 100644 --- a/readmes/README_ja_JP.md +++ b/readmes/README_ja_JP.md @@ -179,14 +179,6 @@ NTP構成ファイルのディレクトリを指定します。 デフォルト値: '0664' -#### `config_template` - -任意 - -データタイプ: 文字列 - -構成ファイルのERBテンプレートへの絶対パスまたは相対パスを指定します(値の例: 'ntp/ntp.conf.erb')。このパラメータと`config_epp`パラメータの**両方**を指定すると、バリデーションエラーが発生します。 - #### `disable_auth` データタイプ: 真偽値(boolean) diff --git a/spec/acceptance/ntp_parameters_spec.rb b/spec/acceptance/ntp_parameters_spec.rb index 8d66f50c1..1b4161d0b 100644 --- a/spec/acceptance/ntp_parameters_spec.rb +++ b/spec/acceptance/ntp_parameters_spec.rb @@ -46,26 +46,6 @@ end end - describe 'config_template' do - before :all do - run_shell("mkdir -p #{modulepath}/test/templates") - # Add spurious template logic to verify the use of the correct template rendering engine - run_shell("echo '<% [1].each do |i| %>erbserver<%= i %><%end %>' >> #{modulepath}/test/templates/ntp.conf.erb") - end - - it 'sets the ntp.conf erb template location' do - pp = "class { 'ntp': config_template => 'test/ntp.conf.erb' }" - apply_manifest(pp, catch_failures: true) - expect(file(config.to_s)).to be_file - expect(file(config.to_s).content).to match 'erbserver1' - end - - it 'sets the ntp.conf epp template location and the ntp.conf erb template location which should fail' do - pp = "class { 'ntp': config_template => 'test/ntp.conf.erb', config_epp => 'test/ntp.conf.epp' }" - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{Cannot supply both config_epp and config_template}i) - end - end - describe 'config_epp' do before :all do run_shell("mkdir -p #{modulepath}/test/templates") @@ -79,11 +59,6 @@ expect(file(config.to_s)).to be_file expect(file(config.to_s).content).to match 'eppserver1' end - - it 'sets the ntp.conf epp template location and the ntp.conf erb template location which should fail' do - pp = "class { 'ntp': config_template => 'test/ntp.conf.erb', config_epp => 'test/ntp.conf.epp' }" - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{Cannot supply both config_epp and config_template}i) - end end describe 'package' do diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb index 6d0906b98..6051de8ca 100644 --- a/spec/classes/ntp_spec.rb +++ b/spec/classes/ntp_spec.rb @@ -38,12 +38,6 @@ it { is_expected.to contain_file('/var/run/ntp/servers-netconfig').with_ensure_absent } if f[:os]['family'] == 'Suse' && f[:os]['release']['major'] == '12' - describe 'allows template to be overridden with erb template' do - let(:params) { { config_template: 'my_ntp/ntp.conf.erb' } } - - it { is_expected.to contain_file(conf_path).with_content(%r{erbserver1}) } - end - describe 'allows template to be overridden with epp template' do let(:params) { { config_epp: 'my_ntp/ntp.conf.epp' } } diff --git a/spec/fixtures/my_ntp/templates/ntp.conf.erb b/spec/fixtures/my_ntp/templates/ntp.conf.erb deleted file mode 100644 index 2284e2f9b..000000000 --- a/spec/fixtures/my_ntp/templates/ntp.conf.erb +++ /dev/null @@ -1,2 +0,0 @@ -# ERB template -<% [1].each do |i| %>erbserver<%= i %><%end %>