Problem/Motivation

Sometimes you have a need of an audit log, to see who deployed what when. Currently we only see that a user deployed a plan, but not what was deployed in it.

Proposed resolution

Optionally (defaulting to false) log this information when deploying a plan.
This would allow the user to see on the watchdog what entities where deployed when and by whom.

Remaining tasks

Do it.

User interface changes

None.

API changes

Method addition to DeployEndpoint. We cannot do this from withing the deploy_log function becasue it does not have access to the DeployAggregator object in order to get the list of deployed entities.

Data model changes

None.

Comments

Manuel Garcia created an issue. See original summary.

manuel garcia’s picture

Status: Active » Needs review
StatusFileSize
new1.31 KB

Status: Needs review » Needs work

The last submitted patch, 2: 2918453-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new561 bytes
new1.68 KB

Fixing minor CS thingy.

Status: Needs review » Needs work

The last submitted patch, 4: 2918453-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new383 bytes
new1.31 KB

Removing unnecessary extra line.

douggreen’s picture

watchdog() strings should not be translated. Just be sure to pass arguments.

douggreen’s picture

Something like (untested):

public function log_deployed_entities($deployment_key, Traversable $iterator) {
  $entities = [];
  foreach ($iterator->getEntities() as $key => $item) {
    $entities[] = $item['type'] . ': ' . $item['id'];
  }
  watchdog('deployed_content', 'Deployed %deploy_key with %entities', [
    '%deploy_key' => $deployment_key,
    '%entities' => implode(', ', $entities),
  ]);
}
manuel garcia’s picture

StatusFileSize
new1.06 KB
new1.28 KB

Thanks @douggreen for the review, addressing that now :)

  • Manuel Garcia committed ad5610c on 7.x-3.x
    Issue #2918453 by Manuel Garcia, douggreen: Optionaly log the deployed...
manuel garcia’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.