mitchellh / vagrant-rackspace

Use Vagrant to manage Rackspace Cloud instances.
MIT License
236 stars 155 forks source link

Requiretty workaround #120

Closed petems closed 9 years ago

petems commented 10 years ago

Discussion here: https://github.com/mitchellh/vagrant-rackspace/issues/115

tty stuff still affects rsync

maxlinc commented 10 years ago

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 commented 10 years ago

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.

petems commented 10 years ago

@maxlinc any thoughts? :+1:

petems commented 9 years ago

@maxlinc any thoughts on this?

maxlinc commented 9 years ago

@smashwilson https://github.com/mitchellh/vagrant-rackspace/pull/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 commented 9 years ago

@maxlinc Aye aye.

petems commented 9 years ago

@maxlinc Cool, I can do that :+1: