Skip to content

Commit

Permalink
Resolve undefined index error
Browse files Browse the repository at this point in the history
  • Loading branch information
nook24 committed Nov 16, 2020
1 parent ee2cd95 commit f9569fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Controller/AgentconnectorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,13 @@ public function updateCheckdata() {
//maybe frontend hint, that the agent certificate has changed (and if it should be trusted)
}
} else { //does not have a certificate or autossl option was disabled after creation
$receivedChecks = $this->processUpdateCheckdata($this->request->getData('hostuuid'), $this->request->getData('checkdata', '{}', false));
$receivedChecks = $this->processUpdateCheckdata($this->request->getData('hostuuid'), $this->request->getData('checkdata', '{}'), false);
}
} else {
$receivedChecks = $this->processUpdateCheckdata($this->request->getData('hostuuid'), $this->request->getData('checkdata', '{}', false));
//Agent is not trusted yet - only sache data to cache
/** @var AgenthostscacheTable $AgenthostscacheTable */
$AgenthostscacheTable = TableRegistry::getTableLocator()->get('Agenthostscache');
$AgenthostscacheTable->saveCacheData($this->request->getData('hostuuid'), $this->request->getData('checkdata', '{}'));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Model/Table/AgentconnectorTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ public function isTrustedFromUser(string $hostuuid) {
*/
public function isTrustedFromUserAndSaveAgentconnectorIfMissing(array $request) {
$hostUuid = $request['hostuuid'];
$checksum = $request['checksum'];

try {
$query = $this->find()
Expand All @@ -209,7 +208,7 @@ public function isTrustedFromUserAndSaveAgentconnectorIfMissing(array $request)

$record = $this->newEntity([
//'hostuuid' => $hostUuid,
//'checksum' => $checksum,
//'checksum' => $request['checksum'],
//'ca_checksum' => $AgentCertificateData->getCaChecksum(),
//'generation_date' => FrozenTime::now(),
//'remote_addr' => $_SERVER['REMOTE_ADDR'] ?? null,
Expand Down

0 comments on commit f9569fc

Please sign in to comment.