Class Dsadmin::Admind::LocalController
In: lib/dsadmin/admind/local_controller.rb
Parent: AdmindController

Controller for maintenance/query actions on the local admind instance. This one is automatically active in each admind instance.

Methods

Public Instance methods

[Source]

    # File lib/dsadmin/admind/local_controller.rb, line 28
28:       def host_for(action)
29:         cfg.instanceid
30:       end

(Action) Get a (nested) hash containing information about the admind instance‘s environment, bug/error/warning counts since startup and currently active requests.

[Source]

    # File lib/dsadmin/admind/local_controller.rb, line 35
35:       def info
36:         rproc = RequestProcessor.instance
37: 
38:         infohash = {
39:           'id'            => cfg.instanceid,
40:           'master'        => cfg.master?,
41:         
42:           'start_time'    => cfg.starttime,
43:           'test_mode'     => TEST_MODE,
44:           'cfgfile'       => cfg.cfgfile,
45:           'install_dir'   => INSTALL_PATH,
46:           'argv'          => ARGV,
47:           'pid'           => Process.pid,
48:           'utime'         => Process.times.utime,
49:           'stime'         => Process.times.stime,
50:           'sysload'       => sys.sysload,
51:           'bug_count'     => log.bug_count,
52:           'error_count'   => log.error_count,
53:           'warning_count' => log.warning_count,
54:           'process_list'  => rproc.ps
55:         }
56:         
57:         respond infohash
58:       end

(Action) Restart the admind instance. Only works for slave instances and is intended to

 be triggered by <tt>/meta/restart</tt>.

[Source]

    # File lib/dsadmin/admind/local_controller.rb, line 63
63:       def restart
64:         raise SecurityError.new("Master instance may not be restarted via /local/restart") if(cfg.master?)
65:         
66:         spawnThread { 
67: #          sleep(2)
68:           AdminDaemon.instance.shutdown(false, true) 
69:         }
70:       end

(Action) Shut down the admind instance. Only works for slave instances and is intended to

 be triggered by <tt>/meta/shutdown</tt>.

[Source]

    # File lib/dsadmin/admind/local_controller.rb, line 75
75:       def shutdown
76:         raise SecurityError.new("Master instance may not be restarted via /local/shutdown") if(cfg.master?)
77:  
78: #        Process.kill('TERM', Process.pid)       
79:         spawnThread { 
80: #          sleep(2)
81:           Thread.pass
82:           AdminDaemon.instance.shutdown(false, false) 
83:         }
84:       end

(Action) Ensure the current instance‘s files (code and configuration) are identical to the ones in a central repository (typically the master instance). This essentially executes the command in configfile:/modules/meta/sync_command. Intended to be triggered by /meta/sync_instances.

[Source]

    # File lib/dsadmin/admind/local_controller.rb, line 91
91:       def sync_instance
92:         csect = cfg.get('modules/meta/sync_command', Hash)
93:         
94:         cmdsect = csect[cfg.instanceid] || csect['default']
95:         cmd = Dsadmin::SystemCommand.new(cmdsect)
96:         cmd.exec
97:       end

[Validate]