specinfra 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7f83e7407af2b5738c3a702d0daae790269bc1a
4
- data.tar.gz: 30c501e8ce344aa57297663367feb6bf5fad9705
3
+ metadata.gz: f9d36561ba5c3bec832fa2088e7eaa25f0da4edd
4
+ data.tar.gz: 6e2a9f7498671b0a7c0cfb87cd82e0900dea92ba
5
5
  SHA512:
6
- metadata.gz: 146e1af883788816aa35bd5a870fcfee73748cee29efb7bfaa45572d3004a99a80f406fa608af839153f46c85e139b5722480de1a34d801099e25b13ffba9df1
7
- data.tar.gz: 9b7afc35c4640bbbef7ac6ece339dbd04f7cfd1bc6a29c73aac4458cd4ac787f2b05eccb8921257a4601d5042b73659360f99a6da0900eda3f3ee4e870676de1
6
+ metadata.gz: 0a1eed7f15f4e770955e3957265c5009615f6b786691057e441b4e797abb98e69fca75a876814f551d06957e09a5c7b22707e308cd2dd6f4d88560db9d865725
7
+ data.tar.gz: 1a01e0781977ce32a18ace566a8a5eb6d3a8db3cedc0293df8a8e4d75ac34418b1036df1a28853949729de9d5d8c605dec54578566a0fc3cbf7b52944f08bd02
@@ -61,8 +61,7 @@ module SpecInfra
61
61
 
62
62
  ssh = SpecInfra.configuration.ssh
63
63
  ssh.open_channel do |channel|
64
- if not SpecInfra.configuration.sudo_password.nil?
65
- # We don't need a PTY because we don't have a sudo password
64
+ if SpecInfra.configuration.sudo_password or SpecInfra.configuration.request_pty
66
65
  channel.request_pty do |ch, success|
67
66
  abort "Could not obtain pty " if !success
68
67
  end
@@ -78,6 +77,11 @@ module SpecInfra
78
77
  end
79
78
 
80
79
  channel.on_extended_data do |ch, type, data|
80
+ if data.match /you must have a tty to run sudo/
81
+ puts data
82
+ abort 'Please set "SpecInfra.configuration.request_pty = true" or "c.request_pty = true" in your spec_helper.rb or other appropreate file.'
83
+ end
84
+
81
85
  if data.match /^sudo: no tty present and no askpass program specified/
82
86
  abort "Please set sudo password by using SUDO_PASSWORD or ASK_SUDO_PASSWORD environment variable"
83
87
  else
@@ -9,9 +9,9 @@ module SpecInfra
9
9
  def check_installed(package, version=nil)
10
10
  escaped_package = escape(package)
11
11
  if version
12
- cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^install ok installed #{escape(version)}$'"
12
+ cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^\\(install\\|hold\\) ok installed #{escape(version)}$'"
13
13
  else
14
- cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep '^install ok installed$'"
14
+ cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep '^\\(install\\|hold\\) ok installed$'"
15
15
  end
16
16
  cmd
17
17
  end
@@ -11,7 +11,8 @@ module SpecInfra
11
11
  :pass_prompt,
12
12
  :sudo_options,
13
13
  :docker_image,
14
- :lxc
14
+ :lxc,
15
+ :request_pty,
15
16
  ].freeze
16
17
 
17
18
  def defaults
@@ -1,3 +1,3 @@
1
1
  module SpecInfra
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  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: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-17 00:00:00.000000000 Z
11
+ date: 2014-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler