Skip to content

Commit

Permalink
Miscellaneous fixes mostly for provisioning (CFM-254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Jun 23, 2023
1 parent 699710c commit c0a4a5f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public function provision(

return $this->syncEntity(
$provisioningTarget,
$entityName,
$className,
$data,
$eligibility
);
Expand Down
8 changes: 8 additions & 0 deletions app/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@
'file' => 'trace',
'url' => env('LOG_TRACE_URL', null),
'scopes' => ['trace'],
],
// We define a rules level to record application rule execution
'rule' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'rule',
'url' => env('LOG_TRACE_URL', null),
'scopes' => ['rule'],
]
],

Expand Down
18 changes: 18 additions & 0 deletions app/src/Lib/Traits/PluggableModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ public function getPluggableModelType(): string {
return Inflector::underscore(StringUtilities::tableToEntityName($this));
}

/**
* Obtain the list of plugin relations, suitable for passing to contains().
*
* @since COmanage Registry v5.0.0
* @return array Array of strings of model names
*/

public function getPluginRelations(): array {
// _pluginModels is an array with entries of the form Plugin.Model
// (eg: SqlConnector.SqlProvisioners) but we want to return an array
// of just the Models for use in contains().

return array_map(
function($v) { $bits = explode('.', $v); return $bits[1] ;},
$this->_pluginModels
);
}

/**
* Instantiate a plugin model that is NOT a Cake Table model.
*
Expand Down
5 changes: 3 additions & 2 deletions app/src/Model/Table/ProvisioningTargetsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ProvisioningTargetsTable extends Table {
use \App\Lib\Traits\AutoViewVarsTrait;
use \App\Lib\Traits\ChangelogBehaviorTrait;
use \App\Lib\Traits\CoLinkTrait;
use \App\Lib\Traits\LabeledLogTrait;
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PluggableModelTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
Expand Down Expand Up @@ -151,9 +152,9 @@ public function provision(
}

$targets = $query->order(['ProvisioningTargets.ordr' => 'ASC'])
->contain($this->getContainableModels())
->contain($this->getPluginRelations())
->all();

foreach($targets as $t) {
// Compare our $context against the target's $status. There are three possible
// contexts, with their corresponding provisionable statuses:
Expand Down

0 comments on commit c0a4a5f

Please sign in to comment.