Class: VagrantPeach::Action::ConfigurePeach
- Inherits:
-
Object
- Object
- VagrantPeach::Action::ConfigurePeach
- Includes:
- Vagrant::Util
- Defined in:
- lib/actions/configure_peach.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ConfigurePeach
constructor
A new instance of ConfigurePeach.
Constructor Details
#initialize(app, env) ⇒ ConfigurePeach
Returns a new instance of ConfigurePeach.
6 7 8 |
# File 'lib/actions/configure_peach.rb', line 6 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/actions/configure_peach.rb', line 10 def call(env) env[:ui].info "in the peach configure action" static_files = File.('../../tools', __FILE__) env[:ui].info static_files machine = env[:machine] machine.communicate.sudo "mkdir -p /peach/tools" machine.communicate.sudo "chown vagrant:vagrant /peach/tools" # copy tools into /peach/tools machine.communicate.upload "#{static_files}/command.py", "/peach/tools/command.py" machine.communicate.upload "#{static_files}/wget", "/peach/tools/wget" machine.communicate.upload "#{static_files}/curl", "/peach/tools/curl" # Setup the peach server machine.communicate.sudo 'mkdir -p /etc/peach' machine.communicate.sudo 'echo {\\"server\\":\\"10.0.2.2:5000\\"} > /etc/peach/conf.json' # Setup the path for all server machine.communicate.sudo %Q(sed -e 's|/peach/tools:||g' -i /etc/environment && sed -e 's|PATH="\\(.*\\)"|PATH="/peach/tools:\\1"|g' -i /etc/environment) machine.communicate.sudo %Q(sed -e 's|/peach/tools:||g' -i /etc/sudoers && sed -e 's|secure_path="\\(.*\\)"|secure_path="/peach/tools:\\1"|g' -i /etc/sudoers) @app.call env end |