PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/puppetlabs/puppet/vendor_modules/host_core/spec/acceptance/tests/
Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64
IP: 159.198.77.92
Choose File :

Url:
Dir : //opt/puppetlabs/puppet/vendor_modules/host_core/spec/acceptance/tests/modify_spec.rb

require 'spec_helper_acceptance'

RSpec.context 'when modifying host files' do
  agents.each do |agent|
    context "on #{agent}" do
      let(:target) { agent.tmpfile('host-modify') }

      after(:each) do
        on(agent, "test #{target} && rm -f #{target}")
      end

      it 'modifies a host address' do
        on agent, "printf '127.0.0.9 test alias\n' > #{target}"
        on(agent, puppet_resource('host', 'test', "target=#{target}",
                                  'ensure=present', 'ip=127.0.0.10', 'host_aliases=alias'))

        on(agent, "cat #{target}") do |result|
          fail_test 'the address was not updated' unless
            %r{^127\.0\.0\.10[[:space:]]+test[[:space:]]+alias[[:space:]]*$}.match?(result.stdout)
        end
      end

      it 'modifies a host alias' do
        on agent, "printf '127.0.0.8 test alias\n' > #{target}"
        on(agent, puppet_resource('host', 'test', "target=#{target}",
                                  'ensure=present', 'ip=127.0.0.8', 'host_aliases=banzai'))

        on(agent, "cat #{target}") do |result|
          fail_test 'the alias was not updated' unless
            %r{^127\.0\.0\.8[[:space:]]+test[[:space:]]+banzai[[:space:]]*$}.match?(result.stdout)
        end
      end
    end
  end
end