specinfra 0.7.3 → 0.8.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: 1a8389569d770c22c4bca42552eef6a1ec767fd6
4
- data.tar.gz: e5ac166c60ea3b00672f862c4fa7dd569e7437b8
3
+ metadata.gz: 0a2dbc0cad70c29af27ba9302a8f8e2c12ee0319
4
+ data.tar.gz: 44678a39c8799d2a3d3f3345395afc158cf81694
5
5
  SHA512:
6
- metadata.gz: b2ccd1dc40d8777188fd05d6c94e6ae0ec8db52b99e80dab2e2c903e63148297d52c3f450c4e26c53d13282d457e8b3939cc247cbd58c037b42a751e6e9ad7ec
7
- data.tar.gz: 35d6956665c667c04453e8c4a8aef5b7199ed7feae0fbe7c00a150dc9af5c3741eb5566805703fc1c02798561fc3f6aa7c74d5604c9eba2b80f494f1b47c631f
6
+ metadata.gz: 8c8206acbcbd6d1cf32699c5eacc586d1ce80f3a614bdc8adca7857e2ecc1532a586699729e8a77bf6d692a88fb1063ca4588e0805e2be2e524a9fe529bb5e68
7
+ data.tar.gz: b2ec935f95136a99b787fbe2fcfcc5a156c603c934550fa302cfbff0f0052bfe285ef6f80aa581963eb60755a9cb56a8e86c32f8d919dd4f6b455a6965d86eaf
@@ -61,14 +61,16 @@ module SpecInfra
61
61
 
62
62
  ssh = SpecInfra.configuration.ssh
63
63
  ssh.open_channel do |channel|
64
- channel.request_pty do |ch, success|
65
- abort "Could not obtain pty " if !success
64
+ if not SpecInfra.configuration.sudo_password.nil?
65
+ # We don't need a PTY because we don't have a sudo password
66
+ channel.request_pty do |ch, success|
67
+ abort "Could not obtain pty " if !success
68
+ end
66
69
  end
67
70
  channel.exec("#{command}") do |ch, success|
68
71
  abort "FAILED: couldn't execute command (ssh.channel.exec)" if !success
69
72
  channel.on_data do |ch, data|
70
73
  if data.match pass_prompt
71
- abort "Please set sudo password by using SUDO_PASSWORD or ASK_SUDO_PASSWORD environment variable" if SpecInfra.configuration.sudo_password.nil?
72
74
  channel.send_data "#{SpecInfra.configuration.sudo_password}\n"
73
75
  else
74
76
  stdout_data += data
@@ -76,7 +78,11 @@ module SpecInfra
76
78
  end
77
79
 
78
80
  channel.on_extended_data do |ch, type, data|
79
- stderr_data += data
81
+ if data.match /^sudo: no tty present and no askpass program specified/
82
+ abort "Please set sudo password by using SUDO_PASSWORD or ASK_SUDO_PASSWORD environment variable"
83
+ else
84
+ stderr_data += data
85
+ end
80
86
  end
81
87
 
82
88
  channel.on_request("exit-status") do |ch, data|
@@ -1,3 +1,3 @@
1
1
  module SpecInfra
2
- VERSION = "0.7.3"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita