Class: OsCtld::Commands::Pool::Install
- Includes:
- OsCtl::Lib::Utils::Log, OsCtl::Lib::Utils::System
- Defined in:
- lib/osctld/commands/pool/install.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #client_handler, #id, #opts
Instance Method Summary collapse
Methods inherited from Base
#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!
Constructor Details
This class inherits a constructor from OsCtld::Commands::Base
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/osctld/commands/pool/install.rb', line 11 def execute if opts[:dataset] && !opts[:dataset].start_with?("#{opts[:name]}/") error!("dataset '#{opts[:dataset]}' is not from zpool '#{opts[:name]}'") end error!('pool already exists') if DB::Pools.contains?(opts[:name]) props = ["#{Pool::PROPERTY_ACTIVE}=yes"] props << "#{Pool::PROPERTY_DATASET}=\"#{opts[:dataset]}\"" if opts[:dataset] zfs(:set, props.join(' '), opts[:name]) OsUp.init(opts[:name], force: true) call_cmd!(Commands::Pool::Import, name: opts[:name]) end |