Fix files data

This commit is contained in:
CHIEFSOFT\ameye
2025-07-15 17:26:46 -04:00
parent 6936e8af2e
commit 476794f5d3
4 changed files with 98 additions and 40 deletions
+38 -38
View File
@@ -207,42 +207,42 @@ abstract class BaseController extends Controller
return 0;
}
public function ansibleProvisionBAD($ansibleToken,$params){
log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ".$ansibleToken);
log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ". serialize( $params));
$result = "Unhandled exception";
$base_url = "http://172.16.4.90:3000";
$PROJECT_ID= 8;
$cookies = tempnam('/tmp','cookie.txt');
# 1. Login
$url = $base_url . "/api/project/$PROJECT_ID/tasks";
log_message('critical', "***** ***** ansibleProvision CALL::URL ". $url);
$ch = curl_init( $url );
# Setup request to send json via POST.
$payload = json_encode( $params );
$authorization = "Authorization: Bearer ".$ansibleToken; // Prepare the authorisation token
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json',$authorization));
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Fetch the headers, not the body content:
# Send request.
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$result = 'HTTP code: ' . $httpcode;
curl_close($ch);
log_message('critical', "***** ***** Provision :: ansibleProvision($httpcode) ".$httpcode);
if ($httpcode != "204") {
return "Login failed! $result";
}
return 0;
}
// public function ansibleProvisionBAD($ansibleToken,$params){
// log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ".$ansibleToken);
// log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ". serialize( $params));
//
// $result = "Unhandled exception";
// $base_url = "http://172.16.4.90:3000";
// $PROJECT_ID= 8;
// $cookies = tempnam('/tmp','cookie.txt');
//
// # 1. Login
// $url = $base_url . "/api/project/$PROJECT_ID/tasks";
// log_message('critical', "***** ***** ansibleProvision CALL::URL ". $url);
// $ch = curl_init( $url );
// # Setup request to send json via POST.
// $payload = json_encode( $params );
// $authorization = "Authorization: Bearer ".$ansibleToken; // Prepare the authorisation token
// curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
// curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json',$authorization));
// # Return response instead of printing.
// curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
// # Fetch the headers, not the body content:
//
// # Send request.
// $result = curl_exec($ch);
// $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// $result = 'HTTP code: ' . $httpcode;
//
// curl_close($ch);
//
// log_message('critical', "***** ***** Provision :: ansibleProvision($httpcode) ".$httpcode);
//
// if ($httpcode != "204") {
// return "Login failed! $result";
// }
//
// return 0;
//
// }
}