| @@ 90-122 (lines=33) @@ | ||
| 87 | $log->endAction(); |
|
| 88 | } |
|
| 89 | ||
| 90 | public function addRole($roleName) |
|
| 91 | { |
|
| 92 | // build our callable |
|
| 93 | $action = function($def, $hostId) use($roleName) { |
|
| 94 | // what are we doing? |
|
| 95 | $log = usingLog()->startAction("add role '{$roleName}' to host '{$hostId}'"); |
|
| 96 | ||
| 97 | // make sure we have an entry for this host |
|
| 98 | if (!isset($def->$hostId)) { |
|
| 99 | $def->$hostId = new BaseObject(); |
|
| 100 | } |
|
| 101 | ||
| 102 | // create our list of roles if we don't have one |
|
| 103 | if (!isset($def->$hostId->roles)) { |
|
| 104 | $def->$hostId->roles = array(); |
|
| 105 | } |
|
| 106 | ||
| 107 | // add the role |
|
| 108 | $def->$hostId->roles[] = $roleName; |
|
| 109 | ||
| 110 | // all done |
|
| 111 | $log->endAction(); |
|
| 112 | }; |
|
| 113 | ||
| 114 | // build our return object |
|
| 115 | $return = new DelayedProvisioningDefinitionAction ( |
|
| 116 | $this->args[0], |
|
| 117 | $action |
|
| 118 | ); |
|
| 119 | ||
| 120 | // all done |
|
| 121 | return $return; |
|
| 122 | } |
|
| 123 | ||
| 124 | public function addParams($params) |
|
| 125 | { |
|
| @@ 82-105 (lines=24) @@ | ||
| 79 | return $tables->$tableName; |
|
| 80 | } |
|
| 81 | ||
| 82 | public function getGroupFromTable($group) |
|
| 83 | { |
|
| 84 | // get our table name from the constructor |
|
| 85 | $tableName = $this->args[0]; |
|
| 86 | ||
| 87 | // what are we doing? |
|
| 88 | $log = Log::usingLog()->startAction("get '{$tableName}->{$group}' table group from runtime config"); |
|
| 89 | ||
| 90 | // get the table config |
|
| 91 | $tables = $this->getAllTables(); |
|
| 92 | ||
| 93 | // make sure we have a table |
|
| 94 | if (!isset($tables->$tableName)){ |
|
| 95 | $tables->$tableName = new BaseObject(); |
|
| 96 | } |
|
| 97 | // make sure we have a group |
|
| 98 | if (!isset($tables->$tableName->$group)) { |
|
| 99 | $tables->$tableName->$group = new BaseObject; |
|
| 100 | } |
|
| 101 | ||
| 102 | // all done |
|
| 103 | $log->endAction(); |
|
| 104 | return $tables->$tableName->$group; |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * getDetails |
|