diff options
author | devega <ma.devega@globunet.com> | 2019-05-17 13:20:56 +0200 |
---|---|---|
committer | devega <ma.devega@globunet.com> | 2019-05-17 13:20:56 +0200 |
commit | 1dde16d74e66dd6699108bc17c03021e3ec96214 (patch) | |
tree | 2fd4e05efe117ce8e6bf8213cf4f15919783074e | |
parent | 3bb879d8b6468a94a44d8c67601b3683b4e8655d (diff) |
- Corregido Inventario Software
- Enviado parámetro sendConfig
- Cambiado nombre parámetro redirect_uri por redirectUri
- Serializado algunos parámetros que no se enviaban
8 files changed, 29 insertions, 14 deletions
diff --git a/admin/WebConsole3/backend/app/doc/engine.json b/admin/WebConsole3/backend/app/doc/engine.json index 3c8a37f9..dee603c5 100644 --- a/admin/WebConsole3/backend/app/doc/engine.json +++ b/admin/WebConsole3/backend/app/doc/engine.json @@ -496,7 +496,7 @@ "name": "Tipo de proceso de arranque" } ], - "sofwaretypes": [ + "softwaretypes": [ { "id": 1, "nemonic": "os", diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/CommandController.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/CommandController.php index 0a683996..7873fc06 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/CommandController.php +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/CommandController.php @@ -250,8 +250,9 @@ class CommandController extends ApiController $id = $data["id"]; $script = $data["script"]; - $clientIds = $data["clients"]; $type = $data["type"]; + $sendConfig = $data["sendConfig"]; + $clientIds = $data["clients"]; $clientIds = explode(",", $clientIds); $clients = $clientRepository->findBy(array("id"=>$clientIds)); @@ -288,7 +289,7 @@ class CommandController extends ApiController $em->persist($trace); $em->flush(); - $result = $this->sendCurl($client,$script,$trace); + $result = $this->sendCurl($client,$script,$trace,$sendConfig); $outputs[] = $result; if($result["error"] != ""){ @@ -319,7 +320,7 @@ class CommandController extends ApiController return $this->view($outputs, $response); } - private function sendCurl($client, $script, $trace) + private function sendCurl($client, $script, $trace, $sendConfig) { $logger = $this->get('monolog.logger.og_server'); @@ -328,13 +329,14 @@ class CommandController extends ApiController //$url = "https://".$ip."cgi-bin/api/LogCommand.sh"; $url = "https://".$ip.":8000/opengnsys/script"; - $redirect_uri = $this->generateUrl('opengnsys_server__api_post_traces', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $redirectUri = $this->generateUrl('opengnsys_server__api_post_traces', array(), UrlGeneratorInterface::ABSOLUTE_URL); $arrayToPost = array( 'id' => $trace->getId(), 'script' => base64_encode($script), 'ip' => $ip, - 'redirect_uri' => $redirect_uri + 'sendConfig'=> $sendConfig, + 'redirectUri' => $redirectUri ); // this will be json_encode. If you don't want to json_encode, use HttpPostJson instead of HttpPostJsonBody $headers[] = "Authorization: ".$agentToken; @@ -349,7 +351,7 @@ class CommandController extends ApiController $logger->info("SEND CURL script: " . $script); $logger->info("SEND CURL ip: " . $ip); $logger->info("SEND CURL token: " . $agentToken); - $logger->info("SEND CURL redirect_uri: " . $redirect_uri); + $logger->info("SEND CURL redirect_uri: " . $redirectUri); $logger->info("SEND CURL postUrl: " .$postUrl); // _GET diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/TraceController.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/TraceController.php index fcac9adc..6692176a 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/TraceController.php +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Controller/Api/TraceController.php @@ -328,7 +328,12 @@ class TraceController extends ApiController $data = explode("\n",trim($data)); foreach ($data as $item){ $item = trim($item); - $type = ""; + if ($item === reset($data)) { + $type = "os"; + }else{ + $type = "app"; + } + $description = $item; if($description != ""){ $logger->info("Software: ".$type." = ".$description); diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Entity/Software.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Entity/Software.php index 19baadf1..6d6c6307 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Entity/Software.php +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Entity/Software.php @@ -15,7 +15,7 @@ class Software extends BaseEntity /** * @var string */ - private $osType; + //private $osType; /** * @var string @@ -63,7 +63,7 @@ class Software extends BaseEntity * @param string $osType * * @return Software - */ + * public function setOsType($osType) { $this->osType = $osType; @@ -75,7 +75,7 @@ class Software extends BaseEntity * Get osType * * @return string - */ + * public function getOsType() { return $this->osType; diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/CommandExecuteType.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/CommandExecuteType.php index 77601b3f..82d773f9 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/CommandExecuteType.php +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/CommandExecuteType.php @@ -27,6 +27,7 @@ class CommandExecuteType extends AbstractType ->add('id', TextType::class) ->add('script', TextType::class) ->add('type', TextType::class) + ->add('sendConfig', TextType::class) ->add('clients', TextType::class) ; } diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/SoftwareType.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/SoftwareType.php index 7fef9f75..fa8915da 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/SoftwareType.php +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Form/Type/Api/SoftwareType.php @@ -25,7 +25,8 @@ class SoftwareType extends AbstractType { $builder ->add('description') - ->add('osType') + ->add('type') + //->add('osType') ; } diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/doctrine/Software.orm.xml b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/doctrine/Software.orm.xml index b4b1ed20..874928df 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/doctrine/Software.orm.xml +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/doctrine/Software.orm.xml @@ -11,7 +11,9 @@ <field name="description" type="string" column="description" length="250" nullable="false"/> + <!-- <field name="osType" column="os_type" type="string" length="60" nullable="true"/> + --> <field name="type" column="type" type="string" length="64" nullable="true"/> diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/serializer/OpengnsysServerBundle/Entity.Software.yml b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/serializer/OpengnsysServerBundle/Entity.Software.yml index 10efcad2..2cef1dd1 100644 --- a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/serializer/OpengnsysServerBundle/Entity.Software.yml +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Resources/config/serializer/OpengnsysServerBundle/Entity.Software.yml @@ -5,10 +5,14 @@ Opengnsys\ServerBundle\Entity\Software: groups: [opengnsys_server__software_get, opengnsys_server__software_cget] expose: true serialized_name: description - osType: + type: groups: [opengnsys_server__software_get, opengnsys_server__software_cget] expose: true - serialized_name: osType + serialized_name: type + #osType: + # groups: [opengnsys_server__software_get, opengnsys_server__software_cget] + # expose: true + # serialized_name: osType id: groups: [opengnsys_server__software_get, opengnsys_server__software_cget] expose: true |