Class: OsCtld::Commands::Logged

Inherits:
Base
  • Object
show all
Defined in:
lib/osctld/commands/logged.rb

Overview

Command template for commands that are to be logged to pool’s history

When logging to history, we need to know which pool the command works with. #find should return an object that responds to ‘pool`, or raise exception. Base#execute is then called with the return value of #find as the first argument. If Base#execute returns success, the command will be logged.

Direct Known Subclasses

Container::Boot, Container::CGParamSet, Container::CGParamUnset, Container::Chgrp, Container::Chown, Container::ConfigReload, Container::ConfigReplace, Container::Copy, Container::Create, Container::CreateEmpty, Container::Delete, Container::DeviceAdd, Container::DeviceChmod, Container::DeviceDelete, Container::DeviceInherit, Container::DevicePromote, Container::DeviceReplace, Container::DeviceSetInherit, Container::Export, Container::Import, Container::MountActivate, Container::MountCreate, Container::MountDataset, Container::MountDeactivate, Container::MountDelete, Container::MountRegister, Container::Move, Container::PrLimitSet, Container::PrLimitUnset, Container::Reinstall, Container::Restart, Container::Set, Container::SetImageConfig, Container::Start, Container::Stop, Container::Unset, Group::CGParamSet, Group::CGParamUnset, Group::Create, Group::Delete, Group::DeviceAdd, Group::DeviceChmod, Group::DeviceDel, Group::DeviceInherit, Group::DevicePromote, Group::DeviceReplace, Group::DeviceSetInherit, Group::DeviceUnsetInherit, Group::Set, Group::Unset, IdRange::Allocate, IdRange::Create, IdRange::Delete, IdRange::Free, IdRange::Set, IdRange::Unset, NetInterface::Create, NetInterface::Delete, NetInterface::IpAdd, NetInterface::IpDel, NetInterface::Rename, NetInterface::RouteAdd, NetInterface::RouteDel, NetInterface::Set, Pool::Set, Pool::Unset, Receive::AuthKeyAdd, Receive::AuthKeyDelete, Repository::Add, Repository::Delete, Repository::Disable, Repository::Enable, Repository::Set, Repository::Unset, Send::KeyGen, User::Create, User::Delete, User::Set, User::Unset

Instance Attribute Summary

Attributes inherited from Base

#client, #client_handler, #id, #opts

Instance Method Summary collapse

Methods inherited from Base

#call_cmd, #call_cmd!, cmd, #error, #error!, #execute, 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

#base_executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/osctld/commands/logged.rb', line 11

def base_execute
  obj = find

  if obj.is_a?(Pool)
    pool = obj
  else
    pool = obj.pool
  end

  ret = execute(obj)

  if ret.is_a?(Hash) && ret[:status] && !indirect?
    History.log(pool, self.class.cmd, opts)
  end

  ret
end

#findObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/osctld/commands/logged.rb', line 29

def find
  raise NotImplementedError
end