Class: Falcon::Command::Host
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Falcon::Command::Host
- Defined in:
- lib/falcon/command/host.rb
Instance Method Summary collapse
- #assume_privileges(path) ⇒ Object
- #call(container = Async::Container.new) ⇒ Object
- #run(container, verbose = false) ⇒ Object
Instance Method Details
#assume_privileges(path) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/falcon/command/host.rb', line 46 def assume_privileges(path) stat = File.stat(path) Process::GID.change_privilege(stat.gid) Process::UID.change_privilege(stat.uid) end |
#call(container = Async::Container.new) ⇒ Object
74 75 76 77 78 |
# File 'lib/falcon/command/host.rb', line 74 def call(container = Async::Container.new) container = run(container, parent&.verbose?) container.wait(true) end |
#run(container, verbose = false) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/falcon/command/host.rb', line 53 def run(container, verbose = false) configuration = Configuration.new(verbose) configuration.load_file(@path) Async.logger.info(self) {"Starting services described by #{@path}..."} assume_privileges(@path) hosts = Hosts.new(configuration) hosts.each do |host| host.run(container) end services = Services.new(configuration) services.each do |service| service.run(container) end return container end |