Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Requiretty workaround #120

Closed
wants to merge 14 commits into from
Closed

Conversation

petems
Copy link

@petems petems commented Jul 24, 2014

Discussion here: #115

tty stuff still affects rsync

maxlinc and others added 8 commits July 25, 2014 00:04
Kept getting 

```
/Users/peterso/Projects/vagrant-rackspace/lib/vagrant-rackspace/action/pre_provision_script.rb:25:in `read': no implicit conversion of Array into String (TypeError)
  from /Users/peterso/Projects/vagrant-rackspace/lib/vagrant-rackspace/action/pre_provision_script.rb:25:in `call'
  from /opt/rubies/2.0.0-p451/lib/ruby/gems/2.0.0/bundler/gems/vagrant-efd1d5e11bfc/lib/vagrant/action/warden.rb:34:in `call'
```
@maxlinc
Copy link
Contributor

maxlinc commented Jul 25, 2014

I made a mistake when I was describing the workaround in #48. I thought it was using personality files like I plan to do for windows, but the workaround in #48 is actually using Fog's SSH/SCP classes.

The reason I used Fog's classes at the time was because Vagrant didn't support PTY then but Fog did. Now that Vagrant supports PTY its probably better to use Vagrant directly. Could you try ripping out all the Fog::SSH and Fog::SCP code and replacing it with pure Vagrant code? I'm not sure, but it might end up as simple as:

def call(env)
  env[:machine].communicate.sudo "sed -i'.bk' -e 's/^\(Defaults\s\+requiretty\)/# \1/' /etc/sudoers"
  @app.call(env) # This was the *first* line in the original PR, but I think should have been last
end

@petems
Copy link
Author

petems commented Jul 30, 2014

Cool, I'm changing it to the easier syntax now.

However I had to do:

def call(env)
  @app.call(env)
  env[:machine].communicate.sudo "sed -i'.bk' -e 's/^\(Defaults\s\+requiretty\)/# \1/' /etc/sudoers"
end

Because otherwise it'd fail with `The provider for this Vagrant-managed machine is reporting that it
is not yet ready for SSH.

Peter Souter added 6 commits July 30, 2014 16:00
As Vagrant now uses tty for it's sudo commands, we don't have to fudge it with fog! 👍
Issues with double quotes creating weird escapes
@petems
Copy link
Author

petems commented Aug 1, 2014

@maxlinc any thoughts? 👍

@petems
Copy link
Author

petems commented Dec 2, 2014

@maxlinc any thoughts on this?

@maxlinc
Copy link
Contributor

maxlinc commented Dec 16, 2014

@smashwilson #124 was an alternative to this, so this PR can be closed.

@petems - You should be able to use the new init_script setting (not released quite yet, but merged to master) as a workaround. The setting would be:

  rs.init_script = 'sed -i\'.bk\' -e \'s/^\(Defaults\s\+requiretty\)/# \1/\' /etc/sudoers'

If you'd a more convient, easier-to-remember solution I would be okay w/ a PR that adds support for pre-definined init_scripts for known workarounds, e.g.:

  rs.init_script = :disable_requiretty

@smashwilson
Copy link
Collaborator

@maxlinc Aye aye.

@petems
Copy link
Author

petems commented Dec 16, 2014

@maxlinc Cool, I can do that 👍

@petems petems deleted the requiretty_workaround branch December 16, 2014 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants