diff -Nru ruby-specinfra-2.76.7/debian/changelog ruby-specinfra-2.76.9/debian/changelog --- ruby-specinfra-2.76.7/debian/changelog 2019-01-13 03:00:34.000000000 +0000 +++ ruby-specinfra-2.76.9/debian/changelog 2019-01-17 01:30:07.000000000 +0000 @@ -1,3 +1,10 @@ +ruby-specinfra (2.76.9-1) unstable; urgency=medium + + [ HIGUCHI Daisuke (VDR dai) ] + * New upstream version 2.76.9 + + -- HIGUCHI Daisuke (VDR dai) Thu, 17 Jan 2019 10:30:07 +0900 + ruby-specinfra (2.76.7-1) unstable; urgency=medium [ HIGUCHI Daisuke (VDR dai) ] diff -Nru ruby-specinfra-2.76.7/lib/specinfra/command/module/ss.rb ruby-specinfra-2.76.9/lib/specinfra/command/module/ss.rb --- ruby-specinfra-2.76.7/lib/specinfra/command/module/ss.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/lib/specinfra/command/module/ss.rb 2019-01-17 01:28:58.000000000 +0000 @@ -3,22 +3,26 @@ module Module module Ss def check_is_listening(port, options={}) - pattern = ":#{port} " - pattern = " #{inaddr_any_to_asterisk(options[:local_address])}#{pattern}" if options[:local_address] - "ss #{command_options(options[:protocol])} | grep -- #{escape(pattern)}" + if options[:local_address] + pattern = inaddr_any_to_asterisk(options[:local_address]).map { |l| " #{l}:#{port} " } + pattern = pattern.join('|') + else + pattern = ":#{port} " + end + "ss #{command_options(options[:protocol])} | grep -E -- #{escape(pattern)}" end private # WORKAROUND: - # ss displays "*" instead of "0.0.0.0". + # Older ss versions display "*" instead of "0.0.0.0". # But serverspec validates IP address by `valid_ip_address?` method: # https://github.com/serverspec/serverspec/blob/master/lib/serverspec/type/port.rb def inaddr_any_to_asterisk(local_address) if local_address == '0.0.0.0' - '\*' + [ '\*' , '0\.0\.0\.0' ] else - local_address + [ local_address ] end end diff -Nru ruby-specinfra-2.76.7/lib/specinfra/command/solaris/base/cron.rb ruby-specinfra-2.76.9/lib/specinfra/command/solaris/base/cron.rb --- ruby-specinfra-2.76.7/lib/specinfra/command/solaris/base/cron.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/lib/specinfra/command/solaris/base/cron.rb 2019-01-17 01:28:58.000000000 +0000 @@ -1,7 +1,7 @@ class Specinfra::Command::Solaris::Base::Cron < Specinfra::Command::Base::Cron class << self def check_has_entry(user, entry) - entry_escaped = entry.gsub(/\*/, '\\*').gsub(/\[/, '\\[').gsub(/\]/, '\\]') + entry_escaped = entry.gsub(/\*/, '\\*').gsub(/\[/, '\\[').gsub(/\]/, '\\]').gsub(/\%/, '\\%') if user.nil? "crontab -l | grep -- #{escape(entry_escaped)}" else diff -Nru ruby-specinfra-2.76.7/lib/specinfra/version.rb ruby-specinfra-2.76.9/lib/specinfra/version.rb --- ruby-specinfra-2.76.7/lib/specinfra/version.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/lib/specinfra/version.rb 2019-01-17 01:28:58.000000000 +0000 @@ -1,3 +1,3 @@ module Specinfra - VERSION = "2.76.7" + VERSION = "2.76.9" end diff -Nru ruby-specinfra-2.76.7/spec/command/amazon2/port_spec.rb ruby-specinfra-2.76.9/spec/command/amazon2/port_spec.rb --- ruby-specinfra-2.76.7/spec/command/amazon2/port_spec.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/spec/command/amazon2/port_spec.rb 2019-01-17 01:28:58.000000000 +0000 @@ -4,5 +4,5 @@ set :os, :family => 'amazon', :release => '2' describe get_command(:check_port_is_listening, '80') do - it { should eq 'ss -tunl | grep -- :80\ ' } + it { should eq 'ss -tunl | grep -E -- :80\ ' } end diff -Nru ruby-specinfra-2.76.7/spec/command/debian8/port_spec.rb ruby-specinfra-2.76.9/spec/command/debian8/port_spec.rb --- ruby-specinfra-2.76.7/spec/command/debian8/port_spec.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/spec/command/debian8/port_spec.rb 2019-01-17 01:28:58.000000000 +0000 @@ -4,5 +4,5 @@ set :os, :family => 'debian', :release => '8' describe get_command(:check_port_is_listening, '80') do - it { should eq 'ss -tunl | grep -- :80\ ' } + it { should eq 'ss -tunl | grep -E -- :80\ ' } end diff -Nru ruby-specinfra-2.76.7/spec/command/debian9/port_spec.rb ruby-specinfra-2.76.9/spec/command/debian9/port_spec.rb --- ruby-specinfra-2.76.7/spec/command/debian9/port_spec.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/spec/command/debian9/port_spec.rb 2019-01-17 01:28:58.000000000 +0000 @@ -4,6 +4,6 @@ set :os, :family => 'debian', :release => '9' describe get_command(:check_port_is_listening, '80') do - it { should eq 'ss -tunl | grep -- :80\ ' } + it { should eq 'ss -tunl | grep -E -- :80\ ' } end diff -Nru ruby-specinfra-2.76.7/spec/command/module/ss_spec.rb ruby-specinfra-2.76.9/spec/command/module/ss_spec.rb --- ruby-specinfra-2.76.7/spec/command/module/ss_spec.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/spec/command/module/ss_spec.rb 2019-01-17 01:28:58.000000000 +0000 @@ -5,24 +5,24 @@ extend Specinfra::Command::Module::Ss end let(:klass) { Specinfra::Command::Module::Ss::Test } - it { expect(klass.check_is_listening('80')).to eq 'ss -tunl | grep -- :80\ ' } + it { expect(klass.check_is_listening('80')).to eq 'ss -tunl | grep -E -- :80\ ' } - it { expect(klass.check_is_listening('80', options={:protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- :80\ ' } - it { expect(klass.check_is_listening('80', options={:protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- :80\ ' } - it { expect(klass.check_is_listening('80', options={:protocol => 'udp'})).to eq 'ss -unl4 | grep -- :80\ ' } - it { expect(klass.check_is_listening('80', options={:protocol => 'udp6'})).to eq 'ss -unl6 | grep -- :80\ ' } + it { expect(klass.check_is_listening('80', options={:protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- :80\ ' } + it { expect(klass.check_is_listening('80', options={:protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- :80\ ' } + it { expect(klass.check_is_listening('80', options={:protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- :80\ ' } + it { expect(klass.check_is_listening('80', options={:protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- :80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0'})).to eq 'ss -tunl | grep -- \ \\\\\*:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- \ \\\\\*:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- \ \\\\\*:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp'})).to eq 'ss -unl4 | grep -- \ \\\\\*:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -- \ \\\\\*:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0'})).to eq 'ss -tunl | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4'})).to eq 'ss -tunl | grep -- \ 1.2.3.4:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- \ 1.2.3.4:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- \ 1.2.3.4:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp'})).to eq 'ss -unl4 | grep -- \ 1.2.3.4:80\ ' } - it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -- \ 1.2.3.4:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4'})).to eq 'ss -tunl | grep -E -- \ 1.2.3.4:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ 1.2.3.4:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ 1.2.3.4:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ 1.2.3.4:80\ ' } + it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ 1.2.3.4:80\ ' } it { expect{klass.check_is_listening('80', options={:protocol => 'bad_proto'})}.to raise_error(ArgumentError, 'Unknown protocol [bad_proto]') } end diff -Nru ruby-specinfra-2.76.7/spec/command/redhat7/port_spec.rb ruby-specinfra-2.76.9/spec/command/redhat7/port_spec.rb --- ruby-specinfra-2.76.7/spec/command/redhat7/port_spec.rb 2019-01-13 02:59:30.000000000 +0000 +++ ruby-specinfra-2.76.9/spec/command/redhat7/port_spec.rb 2019-01-17 01:28:58.000000000 +0000 @@ -4,5 +4,5 @@ set :os, :family => 'redhat', :release => '7' describe get_command(:check_port_is_listening, '80') do - it { should eq 'ss -tunl | grep -- :80\ ' } + it { should eq 'ss -tunl | grep -E -- :80\ ' } end