/usr/lib/ruby/vendor_ruby/aruba/setup.rb is in ruby-aruba 0.14.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | module Aruba
class Setup
private
attr_reader :runtime
public
def initialize(runtime)
@runtime = runtime
end
def call
return if runtime.setup_already_done?
working_directory
events
runtime.setup_done
self
end
private
def working_directory
Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
Aruba.platform.mkdir File.join(runtime.config.root_directory, runtime.config.working_directory)
Aruba.platform.chdir runtime.config.root_directory
end
# rubocop:disable Metrics/MethodLength
def events
runtime.event_bus.register(
:command_started,
proc do |event|
runtime.announcer.announce :command, event.entity.commandline
runtime.announcer.announce :timeout, 'exit', event.entity.exit_timeout
runtime.announcer.announce :timeout, 'io wait', event.entity.io_wait_timeout
runtime.announcer.announce :wait_time, 'startup wait time', event.entity.startup_wait_time
runtime.announcer.announce :full_environment, event.entity.environment
end
)
runtime.event_bus.register(
:command_started,
proc do |event|
runtime.command_monitor.register_command event.entity
runtime.command_monitor.last_command_started = event.entity
end
)
runtime.event_bus.register(
:command_stopped,
proc do |event|
runtime.announcer.announce(:stdout) { event.entity.stdout }
runtime.announcer.announce(:stderr) { event.entity.stderr }
runtime.announcer.announce(:command_content) { event.entity.content }
runtime.announcer.announce(:command_filesystem_status) { event.entity.filesystem_status }
end
)
runtime.event_bus.register(
:command_stopped,
proc do |event|
runtime.command_monitor.last_command_stopped = event.entity
end
)
runtime.event_bus.register(
[:changed_environment_variable, :added_environment_variable, :deleted_environment_variable],
proc do |event|
runtime.announcer.announce :changed_environment, event.entity[:changed][:name], event.entity[:changed][:value]
runtime.announcer.announce :environment, event.entity[:changed][:name], event.entity[:changed][:value]
end
)
runtime.event_bus.register(
:changed_working_directory,
proc { |event| runtime.announcer.announce :directory, event.entity[:new] }
)
runtime.event_bus.register(
:changed_configuration,
proc { |event| runtime.announcer.announce :configuration, event.entity[:changed][:name], event.entity[:changed][:value] }
)
end
# rubocop:enable Metrics/MethodLength
end
end
|