specinfra 2.66.7 → 2.66.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dd5e5c1d5cd0e496d4b9361bb5c1068ad118c8c
4
- data.tar.gz: cfeba690482ec6d325945b6d0b9c45c92d7fdeac
3
+ metadata.gz: 561981aa1509a078fbef21551f3e23376b1710c7
4
+ data.tar.gz: d07b0809683d87b45f64ec6832cd30cf661c0b86
5
5
  SHA512:
6
- metadata.gz: 10d4114db7c064bd5363326cad1a2559befbc95809ff1936f5a59c88d6d0f933c3e8682981a9ace752bea1f864a789674103d8698630aef06d92e78a4fae66e7
7
- data.tar.gz: 9ab48fea0e5de027c4e7f76d7253db174f0ca651977faa2850fa5df43569a47b998b40f95be1da35cbc96a329939cdd24fdad6f111b008e898567eb7f0e29acc
6
+ metadata.gz: 89249b21c9c9d1a85687da44df54180663179b0c7ff2154f75feee6b4ad7a4a89e4c35847090518c5803446613267b541334372a23f7308a8dde059d79de3bd1
7
+ data.tar.gz: ad80a3b1e15891e0e0a63e29ad565402bda605654c412ca8f6e42ad85e850a63109d9eae8fd6af7224adec33c140a0a315d1eb5874fa82e89852b47eb8809dd7
@@ -3,7 +3,7 @@ class Specinfra::Command::Debian::Base::Package < Specinfra::Command::Linux::Bas
3
3
  def check_is_installed(package, version=nil)
4
4
  escaped_package = escape(package)
5
5
  if version
6
- cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{escape(version)}$'"
6
+ cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{Regexp.escape(escape(version))}$'"
7
7
  else
8
8
  cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep -E '^(install|hold) ok installed$'"
9
9
  end
@@ -18,7 +18,7 @@ class Specinfra::Command::Debian::Base::Package < Specinfra::Command::Linux::Bas
18
18
  else
19
19
  full_package = package
20
20
  end
21
- "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' #{option} install #{full_package}"
21
+ "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' #{option} install #{escape(full_package)}"
22
22
  end
23
23
 
24
24
  def get_version(package, opts=nil)
@@ -3,7 +3,8 @@ class Specinfra::Command::Redhat::Base::Package < Specinfra::Command::Linux::Bas
3
3
  def check_is_installed(package, version=nil)
4
4
  cmd = "rpm -q #{escape(package)}"
5
5
  if version
6
- cmd = "#{cmd} | grep -w -- #{escape(package)}-#{escape(version)}"
6
+ full_package = "#{package}-#{version}"
7
+ cmd = "#{cmd} | grep -w -- #{Regexp.escape(escape(full_package))}"
7
8
  end
8
9
  cmd
9
10
  end
@@ -20,7 +21,7 @@ class Specinfra::Command::Redhat::Base::Package < Specinfra::Command::Linux::Bas
20
21
  else
21
22
  full_package = package
22
23
  end
23
- cmd = "yum -y #{option} install #{full_package}"
24
+ cmd = "yum -y #{option} install #{escape(full_package)}"
24
25
  end
25
26
 
26
27
  def remove(package, option='')
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.66.7"
2
+ VERSION = "2.66.8"
3
3
  end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian'
5
+
6
+ describe get_command(:check_package_is_installed, 'telnet') do
7
+ it { should eq "dpkg-query -f '${Status}' -W telnet | grep -E '^(install|hold) ok installed$'" }
8
+ end
9
+
10
+ describe get_command(:check_package_is_installed, 'telnet', '0.17-36build2') do
11
+ it { should eq "dpkg-query -f '${Status} ${Version}' -W telnet | grep -E '^(install|hold) ok installed 0\\.17\\-36build2$'" }
12
+ end
13
+
14
+ describe get_command(:check_package_is_installed, 'linux-headers-$(uname -r)') do
15
+ it 'should be escaped (that is, command substitution should not work)' do
16
+ should eq "dpkg-query -f '${Status}' -W linux-headers-\\$\\(uname\\ -r\\) | grep -E '^(install|hold) ok installed$'"
17
+ end
18
+ end
19
+
20
+ describe get_command(:install_package, 'telnet') do
21
+ it { should eq "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install telnet" }
22
+ end
23
+
24
+ describe get_command(:install_package, 'telnet', '0.17-36build2') do
25
+ it { should eq "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install telnet\\=0.17-36build2" }
26
+ end
27
+
28
+ describe get_command(:install_package, 'linux-headers-$(uname -r)') do
29
+ it 'should be escaped (that is, command substitution should not work)' do
30
+ should eq "DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install linux-headers-\\$\\(uname\\ -r\\)"
31
+ end
32
+ end
@@ -3,6 +3,30 @@ require 'spec_helper'
3
3
  property[:os] = nil
4
4
  set :os, { :family => 'redhat' }
5
5
 
6
- describe get_command(:check_package_is_installed, 'httpd') do
7
- it { should eq 'rpm -q httpd' }
6
+ describe get_command(:check_package_is_installed, 'telnet') do
7
+ it { should eq 'rpm -q telnet' }
8
+ end
9
+
10
+ describe get_command(:check_package_is_installed, 'telnet', '0.17-48.el6.x86_64') do
11
+ it { should eq 'rpm -q telnet | grep -w -- telnet\\-0\\.17\\-48\\.el6\\.x86_64' }
12
+ end
13
+
14
+ describe get_command(:check_package_is_installed, 'linux-headers-$(uname -r)') do
15
+ it 'should be escaped (that is, command substitution should not work' do
16
+ should eq 'rpm -q linux-headers-\\$\\(uname\\ -r\\)'
17
+ end
18
+ end
19
+
20
+ describe get_command(:install_package, 'telnet') do
21
+ it { should eq "yum -y install telnet" }
22
+ end
23
+
24
+ describe get_command(:install_package, 'telnet', '0.17-48.el6.x86_64') do
25
+ it { should eq "yum -y install telnet-0.17-48.el6.x86_64" }
26
+ end
27
+
28
+ describe get_command(:install_package, 'linux-headers-$(uname -r)') do
29
+ it 'should be escaped (that is, command substitution should no work)' do
30
+ should eq "yum -y install linux-headers-\\$\\(uname\\ -r\\)"
31
+ end
8
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.66.7
4
+ version: 2.66.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -535,6 +535,7 @@ files:
535
535
  - spec/command/darwin/port_spec.rb
536
536
  - spec/command/darwin/process_spec.rb
537
537
  - spec/command/darwin/user_spec.rb
538
+ - spec/command/debian/package_spec.rb
538
539
  - spec/command/debian/port_spec.rb
539
540
  - spec/command/debian/service_spec.rb
540
541
  - spec/command/debian8/port_spec.rb
@@ -656,6 +657,7 @@ test_files:
656
657
  - spec/command/darwin/port_spec.rb
657
658
  - spec/command/darwin/process_spec.rb
658
659
  - spec/command/darwin/user_spec.rb
660
+ - spec/command/debian/package_spec.rb
659
661
  - spec/command/debian/port_spec.rb
660
662
  - spec/command/debian/service_spec.rb
661
663
  - spec/command/debian8/port_spec.rb