Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
|
cdc24f0c33 | |
|
74456f85a1 | |
|
33b8cba802 | |
|
c3ee618c6e | |
|
145e50a453 | |
|
02646f0c4b | |
|
852d3ccd14 | |
|
24352cc2c8 | |
|
9713c83f57 | |
|
f778c337fb |
|
@ -20,7 +20,7 @@ JWT_PASSPHRASE=8b9154df37ffa91ef9186ce095324e39e50ff3b023bb1ed34383abd019ba4515
|
|||
###< lexik/jwt-authentication-bundle ###
|
||||
|
||||
###> symfony/mercure-bundle ###
|
||||
MERCURE_URL=https://localhost:3000/.well-known/mercure
|
||||
MERCURE_PUBLIC_URL=https://localhost:3000/.well-known/mercure
|
||||
MERCURE_URL=http://localhost:3000/.well-known/mercure
|
||||
MERCURE_PUBLIC_URL=http://localhost:3000/.well-known/mercure
|
||||
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||
###< symfony/mercure-bundle ###
|
||||
|
|
132
CHANGELOG.md
132
CHANGELOG.md
|
@ -1,132 +1,15 @@
|
|||
# Changelog
|
||||
## [0.14.2] - 2025-06-09
|
||||
### Improved
|
||||
- Cambio en el template base del menu. Ahora apunta a los script de python de manera correcta.
|
||||
|
||||
---
|
||||
## [0.14.1] - 2025-06-09
|
||||
### Fixed
|
||||
- Se han corregido los mensajes de error que se envian cuando las APIs de los modulos no estan disponibles.
|
||||
- Se ha corregido un bug en la herencia de datos entre aulas y grupos, que hacia que no se almacenaran los datos de manera correcta.
|
||||
|
||||
---
|
||||
## [0.14.0] - 2025-06-02
|
||||
### Added
|
||||
- Se ha añadido la funcionalidad de mover equipos entre aulas y grupos.
|
||||
- Se ha añadido la funcionalidad para eliminar imagen cache.
|
||||
- Se ha añadido la funcionalidad para iniciar sesion.
|
||||
|
||||
### Improved
|
||||
- Se ha cambiado la restriccion que comprobaba los puertos de MULTICAST.
|
||||
- Se ha modificado el tiempo en el script, que se encarga de comprobar el estado de los equipos. Ahora es de 1 min en lugar de 3.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido un bug que hacia que al modificar un cliente o eliminarlo, no se actualizaba su estado en la subred.
|
||||
- Se ha corregido un bug que hacia que al modificar un cliente, no se actualizara su fichero de arranque.
|
||||
|
||||
---
|
||||
## [0.13.1] - 2025-05-23
|
||||
### Fixed
|
||||
- Variable de entorno "SSl_ENABLED" desactivada por defecto.
|
||||
|
||||
---
|
||||
## [0.13.0] - 2025-05-20
|
||||
### Added
|
||||
- Se ha creado la base para la comunicacion TLS con el agente.
|
||||
|
||||
### Improved
|
||||
- Refactorizacion de la API para la gestion de llamadas al agente
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido un bug que hacia que no se eliminara la imagen al particionar.
|
||||
|
||||
---
|
||||
## [0.12.1] - 2025-05-14
|
||||
### Improved
|
||||
- Se ha eliminado la restriccion en el formulario de crear/editar repositorio, que hacia que la comprobara el formato de IP. Ahora tambien puede ser DNS.
|
||||
- Mejora en el script de ejecutar tareas.
|
||||
- Ahora al editar la mac de un cliente, se borra el fichero de arranque antiguo.
|
||||
- Se ha añadido una restriccion en plantillas para que tan solo haya 1 por defecto
|
||||
|
||||
---
|
||||
## [0.12.0] - 2025-05-13
|
||||
### Added
|
||||
- Se ha añadido nueva API para poder gestionar las tareas y acciones programadas.
|
||||
- Se ha añadido un nuevo campo en plantillas (defecto) el cual nos permite tener una plantilla por defecto en caso de que se elimine una.
|
||||
- Se ha comenzado la integracion con ogGit.
|
||||
|
||||
### Improved
|
||||
- Mejorado el comportamiento de la API al crear una imagen. Ahora se guardan datos del pc de origen.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido el bug en la creacion de clientes masivos donde no se le asignaba la plantilla PXE.
|
||||
- Se ha corregido un bug en el DTO de clientes, que hacia que PHP diera un timeout por bucle infinito.
|
||||
|
||||
---
|
||||
## [0.11.2] - 2025-04-23
|
||||
### Fixed
|
||||
- Se ha cambiado la forma en guardar la fecha al recibir "ping" de los clientes.
|
||||
|
||||
---
|
||||
## [0.11.1] - 2025-04-16
|
||||
### Fixed
|
||||
- Se ha corregido un error al crear imagen versionada. Si la particion de origen era diferente, no dejaba crear.
|
||||
- Error en la transmision de imagenes. No se actualizaba con la imagen versionada, si no con la canonica.
|
||||
|
||||
---
|
||||
## [0.11.0] - 2025-04-11
|
||||
### Added
|
||||
- Se ha añadido funcionalidad para renombrar imagenes en ogRepository. Nuevo sistema de versionado.
|
||||
- Se ha añadido la integracion con el ogAgent para poder ejecutar scripts.
|
||||
- Se ha añadido el poder añadir descripcion a una imagen.
|
||||
- Se han añadido 2 nuevos campos en la gestion de los repositorios: usuario y puerto ssh.
|
||||
- Se ha añadido funcionalidad para poder gestionar el estado de un equipo de manera automatica. En caso de no haber conexion con el cliente, la web sera notificada en un tiempo maximo de 5 min.
|
||||
|
||||
### Improved
|
||||
- Se han modificado los logs para que puedan "salir" por syslog ademas de por fichero.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido el bug que hacia que cuando habia demasiados clientes, no se mostraran en pantalla debido a un error de memoria.
|
||||
---
|
||||
|
||||
## [0.10.1] - 2025-03-25
|
||||
### Improved
|
||||
- Se ha modificado el script de creación de usuarios, añadiendole la opcion del tipo de visionalizacion por defecto de la vista "grupos".
|
||||
|
||||
## [0.10.0] - 2025-03-25
|
||||
### Added
|
||||
- Nuevo endpoint ogRepository. Convertir imagen en imagen virtual.
|
||||
- Nuevo endpoint ogRepository. Importar imágenes externas al sistema.
|
||||
- Nuevo método para desplegar imagenes sin cache.
|
||||
|
||||
---
|
||||
## [0.9.5] - 2025-03-19
|
||||
### Added
|
||||
- Jenkinsfile updated to publish in repo
|
||||
|
||||
---
|
||||
## [0.9.4] - 2025-03-17
|
||||
### Fixed
|
||||
- Mercure service behind nginx server for containers, expose port in docker compose for nginx
|
||||
|
||||
---
|
||||
## [0.9.3] - 2025-03-17
|
||||
### Fixed
|
||||
- Mercure service behind nginx server for containers
|
||||
|
||||
---
|
||||
## [0.9.2] - 2025-03-12
|
||||
### Fixed
|
||||
- Added mercure service in docker compose file for deployments.
|
||||
|
||||
---
|
||||
## [0.9.1] - 2025-03-12
|
||||
### Fixed
|
||||
### 🐛 Fixed
|
||||
- Corrección en la cancelacion de transmisiones p2p.
|
||||
|
||||
---
|
||||
## [0.9.0] - 2025-03-04
|
||||
### Added
|
||||
### 🔹 Added
|
||||
- Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
|
||||
- Creacion de EventListener en Symfony, para publicar mensajes en Mercure, cuando se realicen cambios en la base de datos ( cambio de estado en lo equipos, y trazas).
|
||||
- Nuevo endpoint "backup image". Integracion con ogRepository.
|
||||
|
@ -136,24 +19,24 @@
|
|||
- Nueva funcionalidad para cancelar despliegues de imagenes.
|
||||
- Añadido nuevo campo "cancelado" en trazas.
|
||||
|
||||
### Changed
|
||||
### ⚡ Changed
|
||||
- Cambios en logs. Cambios en salida (stderror -> file.log)
|
||||
- Modulo DHCP. Añadir equipos, ahora se gestiona con una unica llamada a la API.
|
||||
- Acciones masivas en equipos. Se ha cambiado la respuesta para que no fallen las peticiones si uno o mas equipos no da respuesta.
|
||||
|
||||
---
|
||||
## [0.8.1] - 2025-02-25
|
||||
### Fixed
|
||||
### 🐛 Fixed
|
||||
- Corrección de bug en el deploy de imágenes
|
||||
|
||||
---
|
||||
|
||||
## [0.8.0] - 2025-01-10
|
||||
### Added
|
||||
### 🔹 Added
|
||||
- Nuevos campos en "aulas" para la jerarquia en clientes.
|
||||
- Nueva funcionalidad "imagen global". Integracion con ogRepository.
|
||||
|
||||
### Changed
|
||||
### ⚡ Changed
|
||||
- Limpieza en campos "name" y "date" de ogLive. Es necesario parsear el campo "filename" para facilitar el uso al usuario en la web.
|
||||
### 🐛 Fixed
|
||||
- Corrección de bug que impedia borrar un cliente si tenia una traza enlazada.
|
||||
|
@ -161,7 +44,7 @@
|
|||
|
||||
|
||||
## [0.7.3] - 2025-01-03
|
||||
### Added
|
||||
### 🔹 Added
|
||||
- Adaptados cambios en los endpoints para multiseleccion de clientes.
|
||||
- Se agregó la funcionalidad de importar/exportar. Integración con ogRepository.
|
||||
- Se agregó la funcionalidad de borrar imágenes. Integración con ogRepository.
|
||||
|
@ -176,5 +59,4 @@
|
|||
- **Added**: Secciones con nuevas características.
|
||||
- **Fixed**: Corrección de errores y bugs.
|
||||
- **Changed**: Modificaciones o mejoras en funcionalidades existentes.
|
||||
- **Improved**: Mejoras en funcionalidades existentes.
|
||||
- **Removed**: Funcionalidades o dependencias eliminadas.
|
||||
|
|
|
@ -1,107 +1,28 @@
|
|||
@Library('jenkins-shared-library') _
|
||||
pipeline {
|
||||
agent {
|
||||
label 'jenkins-slave'
|
||||
}
|
||||
environment {
|
||||
DEBIAN_FRONTEND = 'noninteractive'
|
||||
DEFAULT_DEV_NAME = 'Opengnsys Team'
|
||||
DEFAULT_DEV_EMAIL = 'opengnsys@qindel.com'
|
||||
}
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
}
|
||||
parameters {
|
||||
string(name: 'DEV_NAME', defaultValue: '', description: 'Nombre del desarrollador')
|
||||
string(name: 'DEV_EMAIL', defaultValue: '', description: 'Email del desarrollador')
|
||||
BUILD_DIR = "${WORKSPACE}/source"
|
||||
}
|
||||
stages {
|
||||
stage('Prepare Workspace') {
|
||||
steps {
|
||||
script {
|
||||
env.BUILD_DIR = "${WORKSPACE}/ogcore"
|
||||
sh "mkdir -p ${env.BUILD_DIR}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
dir("${env.BUILD_DIR}") {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Generate Changelog') {
|
||||
when {
|
||||
expression {
|
||||
return env.TAG_NAME != null
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME
|
||||
def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL
|
||||
|
||||
generateDebianChangelog(env.BUILD_DIR, devName, devEmail)
|
||||
sh "mkdir -p ${BUILD_DIR}" // Creamos el directorio
|
||||
dir("${BUILD_DIR}") {
|
||||
checkout scm // Hacemos el checkout en el subdirectorio
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Generate Changelog (Nightly)'){
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME
|
||||
def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL
|
||||
generateDebianChangelog(env.BUILD_DIR, devName, devEmail,"nightly")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
construirPaquete(env.BUILD_DIR, "../artifacts", "172.17.8.68", "/var/tmp/opengnsys/debian-repo/ogcore")
|
||||
dir ("${BUILD_DIR}") {
|
||||
sh 'dpkg-buildpackage -us -uc'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Publish to Debian Repository') {
|
||||
when {
|
||||
expression {
|
||||
return env.TAG_NAME != null
|
||||
}
|
||||
}
|
||||
agent { label 'debian-repo' }
|
||||
steps {
|
||||
script {
|
||||
// Construir el patrón de versión esperado en el nombre del paquete
|
||||
def versionPattern = "${env.TAG_NAME}-${env.BUILD_NUMBER}"
|
||||
publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogcore', 'opengnsys-devel', versionPattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Publish to Debian Repository (Nightly)') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
agent { label 'debian-repo' }
|
||||
steps {
|
||||
script {
|
||||
// Construir el patrón de versión esperado en el nombre del paquete
|
||||
def versionPattern = "-${env.BUILD_NUMBER}~nightly"
|
||||
publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogcore', 'nightly', versionPattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
notifyBuildStatus('narenas@qindel.com')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ resources:
|
|||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ChangeOrganizationalUnitInput
|
||||
uriTemplate: /clients/change-organizational-unit
|
||||
uriTemplate: /clients/change-organizational-units
|
||||
controller: App\Controller\ChangeOrganizationalUnitAction
|
||||
|
||||
agent_status:
|
||||
|
@ -50,34 +50,6 @@ resources:
|
|||
uriTemplate: /clients/server/{uuid}/get-pxe
|
||||
controller: App\Controller\OgBoot\PxeBootFile\GetAction
|
||||
|
||||
boot_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\BootClientsInput
|
||||
uriTemplate: /clients/server/boot-client
|
||||
controller: App\Controller\OgAgent\LoginAction
|
||||
|
||||
remove_cache_image:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\BootClientsInput
|
||||
uriTemplate: /clients/server/remove-cache-image
|
||||
controller: App\Controller\OgAgent\RemoveCacheImageAction
|
||||
|
||||
hardware_inventory:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /clients/server/{uuid}/hardware-inventory
|
||||
controller: App\Controller\OgAgent\HardwareInventoryAction
|
||||
|
||||
software_inventory:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\SoftwareInventoryPartitionInput
|
||||
uriTemplate: /clients/server/{uuid}/software-inventory
|
||||
controller: App\Controller\OgAgent\SoftwareInventoryAction
|
||||
|
||||
reboot_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
|
|
|
@ -7,8 +7,6 @@ resources:
|
|||
groups: ['default', 'command:read']
|
||||
denormalizationContext:
|
||||
groups: ['command:write']
|
||||
order:
|
||||
id: 'DESC'
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandProvider
|
||||
|
@ -30,8 +28,9 @@ resources:
|
|||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\CommandExecuteInput
|
||||
uriTemplate: /commands/run-script
|
||||
controller: App\Controller\OgAgent\RunScriptAction
|
||||
uriTemplate: /commands/{uuid}/execute
|
||||
controller: App\Controller\CommandExecuteAction
|
||||
|
||||
properties:
|
||||
App\Entity\Command:
|
||||
id:
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
resources:
|
||||
App\Entity\CommandTaskSchedule:
|
||||
processor: App\State\Processor\CommandTaskScheduleProcessor
|
||||
input: App\Dto\Input\CommandTaskScheduleInput
|
||||
output: App\Dto\Output\CommandTaskScheduleOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'command-task-schedule:read']
|
||||
denormalizationContext:
|
||||
groups: ['command-task-schedule:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
filters:
|
||||
- 'api_platform.filter.command_task_schedule.order'
|
||||
- 'api_platform.filter.command_task_schedule.search'
|
||||
- 'api_platform.filter.command_task_schedule.boolean'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\CommandTaskSchedule:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -1,32 +0,0 @@
|
|||
resources:
|
||||
App\Entity\CommandTaskScript:
|
||||
processor: App\State\Processor\CommandTaskScriptProcessor
|
||||
input: App\Dto\Input\CommandTaskScriptInput
|
||||
output: App\Dto\Output\CommandTaskScriptOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'command-task-script:read']
|
||||
denormalizationContext:
|
||||
groups: ['command-task-script:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
filters:
|
||||
- 'api_platform.filter.command_task_script.order'
|
||||
- 'api_platform.filter.command_task_script.search'
|
||||
- 'api_platform.filter.command_task_script.boolean'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\CommandTaskScript:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -1,50 +0,0 @@
|
|||
resources:
|
||||
App\Entity\GitImageRepository:
|
||||
processor: App\State\Processor\GitImageRepositoryProcessor
|
||||
input: App\Dto\Input\GitImageRepositoryInput
|
||||
output: App\Dto\Output\GitImageRepositoryOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'git-image-repository:read']
|
||||
denormalizationContext:
|
||||
groups: ['git-image-repository:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
filters:
|
||||
- 'api_platform.filter.image_image_repository.order'
|
||||
- 'api_platform.filter.image_image_repository.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
get_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Get image in OgRepository
|
||||
class: ApiPlatform\Metadata\Get
|
||||
method: GET
|
||||
input: false
|
||||
uriTemplate: /image-image-repositories/server/{uuid}/get
|
||||
controller: App\Controller\OgRepository\Image\GetAction
|
||||
|
||||
get_image_tags:
|
||||
shortName: OgRepository Server
|
||||
description: Get image tags in OgRepository
|
||||
class: ApiPlatform\Metadata\Get
|
||||
method: GET
|
||||
input: false
|
||||
uriTemplate: /git-image-repositories/server/{uuid}/get-tags
|
||||
controller: App\Controller\OgRepository\Git\GetTagsAction
|
||||
|
||||
|
||||
properties:
|
||||
App\Entity\GitImageRepository:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -56,22 +56,6 @@ resources:
|
|||
uriTemplate: /image-image-repositories/{uuid}/backup-image
|
||||
controller: App\Controller\OgRepository\Image\BackupImageAction
|
||||
|
||||
convert_image_to_virtual_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ConvertImageToVirtualInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/convert-image-to-virtual
|
||||
controller: App\Controller\OgRepository\Image\ConvertImageToVirtualAction
|
||||
|
||||
rename_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\RenameImageInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/rename-image
|
||||
controller: App\Controller\OgRepository\Image\RenameAction
|
||||
|
||||
trash_delete_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Delete Image in OgRepository
|
||||
|
@ -104,7 +88,7 @@ resources:
|
|||
description: Export Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\TransferGlobalImageInput
|
||||
input: App\Dto\Input\ExportImportImageRepositoryInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/transfer-image
|
||||
controller: App\Controller\OgRepository\Image\TransferAction
|
||||
|
||||
|
@ -117,15 +101,6 @@ resources:
|
|||
uriTemplate: /image-image-repositories/server/{uuid}/status
|
||||
controller: App\Controller\OgRepository\Image\GetStatusAction
|
||||
|
||||
transfer_global_image_repository:
|
||||
shortName: OgRepository Server
|
||||
description: Transfer Global Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-image-repositories/server/{uuid}/transfer-global
|
||||
controller: App\Controller\OgRepository\Image\TransferGlobalAction
|
||||
|
||||
properties:
|
||||
App\Entity\ImageImageRepository:
|
||||
id:
|
||||
|
|
|
@ -30,7 +30,7 @@ resources:
|
|||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/{uuid}/sync
|
||||
controller: App\Controller\OgRepository\Image\SyncAction
|
||||
controller: App\Controller\OgRepository\SyncAction
|
||||
|
||||
wol_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
|
@ -46,7 +46,7 @@ resources:
|
|||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/{uuid}/get-collection
|
||||
controller: App\Controller\OgRepository\Image\GetCollectionAction
|
||||
controller: App\Controller\OgRepository\GetCollectionAction
|
||||
|
||||
images_ogrepository_status:
|
||||
shortName: OgRepository Server
|
||||
|
@ -57,40 +57,14 @@ resources:
|
|||
uriTemplate: /image-repositories/server/{uuid}/status
|
||||
controller: App\Controller\OgRepository\StatusAction
|
||||
|
||||
import_image_ogrepository:
|
||||
export_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Export Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ImportImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/import-image
|
||||
controller: App\Controller\OgRepository\Image\ImportAction
|
||||
|
||||
convert_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Convert Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ConvertImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/convert-image
|
||||
controller: App\Controller\OgRepository\Image\ConvertAction
|
||||
|
||||
get_collection_images_oggit:
|
||||
shortName: OgRepository Server
|
||||
description: Get collection of image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/git/{uuid}/get-collection
|
||||
controller: App\Controller\OgRepository\Git\GetCollectionAction
|
||||
|
||||
git_image_ogrepository_sync:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/git/{uuid}/sync
|
||||
controller: App\Controller\OgRepository\Git\SyncAction
|
||||
input: App\Dto\Input\ExportImportImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/export-image
|
||||
controller: App\Controller\OgRepository\Image\ExportAction
|
||||
|
||||
properties:
|
||||
App\Entity\ImageRepository:
|
||||
|
|
|
@ -4,7 +4,6 @@ resources:
|
|||
input: App\Dto\Input\PartitionPostInput
|
||||
output: App\Dto\Output\PartitionOutput
|
||||
order:
|
||||
diskNumber: 'ASC'
|
||||
partitionNumber: 'ASC'
|
||||
normalizationContext:
|
||||
groups: ['default', 'partition:read']
|
||||
|
|
|
@ -13,7 +13,6 @@ resources:
|
|||
filters:
|
||||
- 'api_platform.filter.software.order'
|
||||
- 'api_platform.filter.software.search'
|
||||
- 'software.software_profile_filter'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
|
|
|
@ -9,8 +9,6 @@ resources:
|
|||
filters:
|
||||
- 'api_platform.filter.trace.order'
|
||||
- 'api_platform.filter.trace.search'
|
||||
- 'api_platform.filter.trace.date'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\TraceProvider
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ framework:
|
|||
handler_id: null
|
||||
cookie_secure: auto
|
||||
cookie_samesite: lax
|
||||
storage_factory_id: session.storage.factory.native
|
||||
|
||||
#esi: true
|
||||
#fragments: true
|
||||
|
|
|
@ -15,12 +15,6 @@ when@dev:
|
|||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
syslog:
|
||||
type: syslog
|
||||
ident: "ogcore"
|
||||
level: info
|
||||
formatter: App\Formatter\CustomLineFormatter
|
||||
channels: ["!event"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
|
@ -48,12 +42,6 @@ when@prod:
|
|||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
syslog:
|
||||
type: syslog
|
||||
ident: "ogcore"
|
||||
level: info
|
||||
formatter: App\Formatter\CustomLineFormatter
|
||||
channels: ["!event"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
|
|
|
@ -33,7 +33,6 @@ security:
|
|||
- { path: ^/og-repository/webhook, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/og-lives/install/webhook, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/auth/refresh, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/validate, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/menu-browser, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/menu/, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
|
||||
|
|
|
@ -14,4 +14,4 @@ when@test:
|
|||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler: { collect: false }
|
||||
profiler: { collect: false }
|
||||
|
|
|
@ -156,18 +156,3 @@ services:
|
|||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\CommandTaskScheduleProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\CommandTaskScriptProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\GitImageRepositoryProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
|
|
@ -41,52 +41,6 @@ services:
|
|||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~, 'readOnly': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
@ -107,7 +61,7 @@ services:
|
|||
|
||||
api_platform.filter.image.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'repository.id': 'exact', status: 'exact', type: 'exact' } ]
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'repository.id': 'exact', status: 'exact'} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.image.boolean:
|
||||
|
@ -119,10 +73,6 @@ services:
|
|||
parent: 'App\Filter\ImageSearchRepositoryFilter'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
software.software_profile_filter:
|
||||
parent: 'App\Filter\SoftwareProfileSearchSoftwareFilter'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.og_live.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
|
@ -132,7 +82,7 @@ services:
|
|||
|
||||
api_platform.filter.og_live.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'status': 'exact' } ]
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.og_live.boolean:
|
||||
|
@ -217,7 +167,7 @@ services:
|
|||
|
||||
api_platform.filter.pxe_template.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'synchronized': ~, 'isDefault': ~ } ]
|
||||
arguments: [ { 'synchronized': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.remote_calendar.order:
|
||||
|
@ -281,7 +231,7 @@ services:
|
|||
|
||||
api_platform.filter.software_profile.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'description': 'partial'} ]
|
||||
arguments: [ { 'id': 'exact', 'description': 'partial' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.subnet.order:
|
||||
|
@ -298,7 +248,7 @@ services:
|
|||
|
||||
api_platform.filter.trace.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'command': 'exact', 'client.id': 'exact', status: 'exact' } ]
|
||||
arguments: [ { 'id': 'exact', 'command.id': 'exact', 'client.id': 'exact', status: 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.trace.order:
|
||||
|
@ -308,11 +258,6 @@ services:
|
|||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.trace.date:
|
||||
parent: 'api_platform.doctrine.orm.date_filter'
|
||||
arguments: [ { 'executedAt': ~, 'createdAt': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
|
|
|
@ -1,53 +1,14 @@
|
|||
ogcore (0.9.2-1) unstable; urgency=medium
|
||||
ogcore (1.0.5+develop20250310-1) unstable; urgency=medium
|
||||
|
||||
* Added mercure service in docker compose file for deployments.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Wed, 12 Mar 2025 14:00:00 +0200
|
||||
|
||||
ogcore (0.9.1-1) unstable; urgency=medium
|
||||
|
||||
* Corrección en la cancelación de transmisiones p2p.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Wed, 12 Mar 2025 13:00:00 +0200
|
||||
|
||||
ogcore (0.9.0-1) unstable; urgency=medium
|
||||
|
||||
* Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
|
||||
* Creación de EventListener en Symfony, para publicar mensajes en Mercure cuando se realicen cambios en la base de datos.
|
||||
* Nuevo endpoint "backup image". Integración con ogRepository.
|
||||
* Nuevo campo en "usuarios" para escoger la visualización por defecto de la vista "grupos".
|
||||
* Nuevo campo "dns" en "subredes" para gestionar los servidores DNS.
|
||||
* Integración de endpoint ogRepository para verificar la integridad de una imagen.
|
||||
* Nueva funcionalidad para cancelar despliegues de imágenes.
|
||||
* Añadido nuevo campo "cancelado" en trazas.
|
||||
* Cambios en logs: salida redirigida de stderr a file.log.
|
||||
* Modificación en módulo DHCP: gestión de equipos con una única llamada a la API.
|
||||
* Cambios en las respuestas de acciones masivas en equipos para evitar fallos en peticiones parciales.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Tue, 04 Mar 2025 15:00:00 +0200
|
||||
|
||||
ogcore (0.8.1-1) unstable; urgency=medium
|
||||
|
||||
* Corrección de bug en el deploy de imágenes.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Tue, 25 Feb 2025 10:00:00 +0200
|
||||
|
||||
ogcore (0.8.0-1) unstable; urgency=medium
|
||||
|
||||
* Nuevos campos en "aulas" para la jerarquía en clientes.
|
||||
* Nueva funcionalidad "imagen global". Integración con ogRepository.
|
||||
* Limpieza en campos "name" y "date" de ogLive. Ahora se parsea el campo "filename" para mejorar la experiencia del usuario.
|
||||
* Corrección de bug que impedía borrar un cliente si tenía una traza enlazada.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Fri, 10 Jan 2025 12:00:00 +0200
|
||||
|
||||
ogcore (0.7.3-1) unstable; urgency=medium
|
||||
|
||||
* Adaptados cambios en los endpoints para multiselección de clientes.
|
||||
* Se agregó la funcionalidad de importar/exportar. Integración con ogRepository.
|
||||
* Se agregó la funcionalidad de borrar imágenes. Integración con ogRepository.
|
||||
* Se agregó el modo "TORRENT" y "UDPCAST" en el despliegue de imágenes.
|
||||
* Refactorización del webhook de ogRepository.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Fri, 03 Jan 2025 11:00:00 +0200
|
||||
* Modified changelog
|
||||
* Some improvements. Fixed multi select actions
|
||||
* refs #1644. Cancel deployImage action
|
||||
* Updated test phunit.xml
|
||||
* Updated test
|
||||
* Merge branch 'main' into develop
|
||||
* Fixed phpxml
|
||||
* Fixed phpxml
|
||||
* Changed test
|
||||
* Changed repoClient funcionality. New filters added
|
||||
|
||||
-- Tu Nombre <tuemail@example.com> Mon, 10 Mar 2025 10:59:14 +0000
|
||||
|
|
|
@ -2,7 +2,7 @@ Source: ogcore
|
|||
Section: web
|
||||
Priority: optional
|
||||
Maintainer: Nicolas Arenas <nicolas.arenas@qindel.com>
|
||||
Build-Depends: debhelper (>= 12), composer, php-cli, php-mysql, php-fpm, libzip-dev, zip, unzip
|
||||
Build-Depends: debhelper (>= 12), composer, php-cli, php-mysql, nginx, php-fpm, libzip-dev, zip, unzip
|
||||
Standards-Version: 4.5.0
|
||||
|
||||
Package: ogcore
|
||||
|
@ -12,5 +12,5 @@ Depends: ${misc:Depends}, mariadb-server, systemd, nginx, libzip-dev, zip, unzip
|
|||
php8.3-gd, php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-common,
|
||||
php8.3-xml, php8.3-zip, mercure
|
||||
Description: OpenGnsys Core
|
||||
OgCore package is responsible about management of Opengnsys platform
|
||||
This is a longer description of the ogcore package.
|
||||
OpenGnsys Core is a platform for system management.
|
||||
|
|
|
@ -4,35 +4,10 @@ set -e
|
|||
set -x
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
restore_config_if_modified() {
|
||||
local new="$1"
|
||||
local backup="$1.bak"
|
||||
|
||||
if [ -f "$backup" ]; then
|
||||
if ! cmp -s "$new" "$backup"; then
|
||||
echo ">>> Archivo modificado por el usuario detectado en $new"
|
||||
echo " - Guardando archivo nuevo como ${new}.new"
|
||||
mv -f "$new" "${new}.new"
|
||||
echo " - Restaurando archivo anterior desde backup"
|
||||
mv -f "$backup" "$new"
|
||||
else
|
||||
echo ">>> El archivo $new no ha cambiado desde la última versión, eliminando backup"
|
||||
rm -f "$backup"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
USER="opengnsys"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Detectar si es una instalación nueva o una actualización
|
||||
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
||||
# Detectar IP de la interfaz de red asociad a la ruta por defecto.
|
||||
|
||||
IP=$(ip -4 route get 8.8.8.8 | grep -oP '(?<=src )[\d.]+')
|
||||
echo ">>> Instalación nueva detectada."
|
||||
|
||||
# Solicitar credenciales solo en instalación nueva
|
||||
|
@ -50,8 +25,7 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|||
|
||||
# Configuración inicial
|
||||
echo ">>> Configurando base de datos y permisos"
|
||||
mariadb -e "ALTER USER 'root'@'localhost' IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD('root');"
|
||||
|
||||
mariadb -e "GRANT ALL ON *.* to 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;"
|
||||
|
||||
echo ">>> Creando par de claves para JWT"
|
||||
php bin/console lexik:jwt:generate-keypair --overwrite
|
||||
|
@ -68,7 +42,6 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|||
|
||||
echo ">>> Configurando servidor web y servicios"
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf /etc/nginx/sites-enabled/mercure.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
|
||||
|
||||
|
@ -80,31 +53,29 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|||
systemctl restart og-mercure
|
||||
systemctl restart nginx
|
||||
systemctl restart php8.3-fpm
|
||||
|
||||
#Obteniendo bearer token
|
||||
BEARER=$(curl -sk -X 'POST' 'https://localhost:8443/auth/login' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{ "username": "ogadmin", "password": "12345678" }' | jq -r .token)
|
||||
# Creando nuevo repo
|
||||
curl -skL -X POST 'https://localhost:8443/image-repositories' \
|
||||
-H "Authorization: Bearer $BEARER" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{ \"name\": \"Repository 1\", \"ip\": \"$IP\", \"comments\": \"Repositorio creado automaticamente por oginstaller\" }"
|
||||
# Solo gestionar credenciales en instalación nueva
|
||||
if [ "$ADMIN_USER" == "ogadmin" ]; then
|
||||
echo ">>> Cambiando contraseña de ogadmin"¡
|
||||
BEARER=$(curl -sk -X 'POST' 'https://localhost:8443/auth/login' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{ "username": "ogadmin", "password": "12345678" }' | jq -r .token)
|
||||
|
||||
echo ">>> Cambiando contraseña de ogadmin"
|
||||
|
||||
OGADMIN_UUID=$(curl -skL "https://localhost:8443/users/?username=ogadmin" \
|
||||
-H 'accept: application/json' \
|
||||
-H "Authorization: Bearer $BEARER" | jq -r '.[0].uuid')
|
||||
|
||||
curl -skL -X PUT "https://localhost:8443/users/$OGADMIN_UUID/reset-password" \
|
||||
-H 'accept: application/ld+json' \
|
||||
-H 'Content-Type: application/ld+json' \
|
||||
-H "Authorization: Bearer $BEARER" \
|
||||
-d "{ \"currentPassword\": \"12345678\", \"newPassword\": \"$ADMIN_PASS\", \"repeatNewPassword\": \"$ADMIN_PASS\" }"
|
||||
|
||||
echo ">>> Contraseña de ogadmin cambiada."
|
||||
else
|
||||
echo ">>> Creando nuevo usuario administrador: $ADMIN_USER"
|
||||
|
||||
curl -skL --location 'https://localhost:8443/users' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--header "Authorization: Bearer $BEARER" \
|
||||
|
@ -112,48 +83,29 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|||
|
||||
echo ">>> Usuario administrador $ADMIN_USER creado."
|
||||
fi
|
||||
# Install crontab
|
||||
echo ">>> Configurando cron para comprobar disponibilidad de clientes"
|
||||
cp /opt/opengnsys/ogcore/etc/cron.d/opengnsys-check-clients /etc/cron.d/opengnsys-check-clients
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
|
||||
|
||||
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
||||
echo ">>> Actualización detectada desde la versión $2"
|
||||
|
||||
# Restaurar archivos de configuración si han sido modificados
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/api/env.json"
|
||||
|
||||
cd /opt/opengnsys/ogcore/api
|
||||
|
||||
echo ">>> Aplicando migraciones de base de datos"
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
echo ">>> Configurando servidor web y servicios"
|
||||
[ ! -L /etc/nginx/sites-enabled/ogcore.conf ] && ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
[ ! -L /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf ] && ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
[ ! -L /etc/systemd/system/og-mercure.service ] && ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
|
||||
echo ">>> Configurando permisos de archivos"
|
||||
chown opengnsys:www-data /opt/opengnsys/
|
||||
chown -R opengnsys:www-data /opt/opengnsys/ogcore
|
||||
if [ ! -f /etc/cron.d/opengnsys-check-clients ]; then
|
||||
echo ">>> Configurando cron para comprobar disponibilidad de clientes"
|
||||
cp /opt/opengnsys/ogcore/etc/cron.d/opengnsys-check-clients /etc/cron.d/opengnsys-check-clients
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
else
|
||||
echo ">>> El archivo de cron ya existe, no se realizan cambios se ajustan permisos"
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
systemctl enable og-mercure
|
||||
systemctl restart og-mercure
|
||||
systemctl restart nginx
|
||||
systemctl restart php8.3-fpm
|
||||
fi
|
||||
fi
|
||||
|
||||
# Recargar systemd y reiniciar servicios en ambos casos
|
||||
|
||||
|
||||
|
|
|
@ -2,19 +2,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
backup_file_if_exists() {
|
||||
local original="$1"
|
||||
local backup="$1.bak"
|
||||
|
||||
if [ -e "$original" ]; then
|
||||
echo " - Guardando backup de $original en $backup"
|
||||
cp -a "$original" "$backup"
|
||||
fi
|
||||
}
|
||||
|
||||
CONFIG_FILE="/opt/opengnsys/ogcore/api/env.json"
|
||||
BACKUP_FILE="/opt/opengnsys/ogcore/api/env.json.bak"
|
||||
|
||||
# Asegurarse de que el usuario exista
|
||||
USER="opengnsys"
|
||||
HOME_DIR="/opt/opengnsys"
|
||||
|
@ -25,18 +12,4 @@ else
|
|||
useradd -m -d "$HOME_DIR" -s /bin/bash "$USER"
|
||||
fi
|
||||
|
||||
CONFIG_FILE="/opt/opengnsys/ogcore/api/env.json"
|
||||
BACKUP_FILE="/opt/opengnsys/ogcore/api/env.json.bak"
|
||||
|
||||
# Solo hacemos backup si el archivo existe y es una actualización (posición 1 = upgrade)
|
||||
if [ "$1" = "upgrade" ]; then
|
||||
echo ">>> Backup de archivos de configuración reales en /opt/opengnsys"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/api/env.json"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
exit 0
|
|
@ -8,5 +8,5 @@ override_dh_auto_build:
|
|||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
export APP_ENV=prod
|
||||
dh_auto_build
|
||||
COMPOSER_ALLOW_SUPERUSER=1 APP_ENV=prod composer install --no-dev --no-interaction --no-progress --optimize-autoloader
|
||||
COMPOSER_ALLOW_SUPERUSER=1 APP_ENV=prod composer dump-env prod
|
||||
composer dump-env prod
|
||||
composer install --no-dev --no-interaction --no-progress --optimize-autoloader
|
||||
|
|
|
@ -20,7 +20,6 @@ services:
|
|||
ports:
|
||||
- 8080:80
|
||||
- 8443:443
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ogpublic:/var/www/html/public:cached
|
||||
networks:
|
||||
|
@ -53,8 +52,8 @@ services:
|
|||
cors_origins *
|
||||
# Comment the following line to disable the development mode
|
||||
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||
# ports:
|
||||
# - "3000:3000"
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- mercure_data:/data
|
||||
- mercure_config:/config
|
||||
|
|
|
@ -26,8 +26,7 @@ services:
|
|||
- 8443:443 # Añadir el puerto 443
|
||||
volumes:
|
||||
- ./public:/var/www/html/public:cached
|
||||
- ./docker/certs:/etc/nginx/certs
|
||||
- ./certs:/opt/opengnsys/ogcore/etc/certificates
|
||||
- ./docker/certs:/etc/nginx/certs # Montar certificados en Nginx
|
||||
networks:
|
||||
- ogcore-network
|
||||
|
||||
|
@ -38,7 +37,6 @@ services:
|
|||
dockerfile: ./docker/Dockerfile-php
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
- ./certs:/opt/opengnsys/ogcore/etc/certificates
|
||||
depends_on:
|
||||
- database
|
||||
networks:
|
||||
|
|
|
@ -12,11 +12,20 @@ server {
|
|||
root /var/www/html/public;
|
||||
index index.html index.php;
|
||||
|
||||
#ssl_certificate /opt/opengnsys/ogcore/etc/certificates/ogcore.crt;
|
||||
#ssl_certificate_key /opt/opengnsys/ogcore/etc/certificates/ogcore.key;
|
||||
ssl_certificate /etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location /.well-known/mercure {
|
||||
proxy_pass https://mercure:3000/.well-known/mercure;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /opengnsys/rest/ous// {
|
||||
rewrite ^/opengnsys/rest/ous//([0-9]+)/images /opengnsys/rest/ous/$1/images;
|
||||
rewrite ^/opengnsys/rest/ous//([0-9]+)/labs /opengnsys/rest/ous/$1/labs;
|
||||
|
@ -44,31 +53,4 @@ server {
|
|||
|
||||
error_log /var/log/nginx/error.log debug;
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
#ssl_client_certificate /opt/opengnsys/ogcore/etc/certificates/ca.crt;
|
||||
#ssl_verify_client on;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3000 ssl http2;
|
||||
listen [::]:3000 ssl http2;
|
||||
|
||||
|
||||
ssl_certificate /etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://ogcore-mercure:3000/;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
# Enable fast reply in SSE
|
||||
proxy_buffering off;
|
||||
|
||||
## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
13
env.json
13
env.json
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
"vars": {
|
||||
"OG_DHCP_API_URL": "127.0.0.1:8081",
|
||||
"OG_CORE_IP": "127.0.0.1",
|
||||
"OG_LOG_IP": "127.0.0.1",
|
||||
"OG_BOOT_API_URL": "192.168.68.51:8082",
|
||||
"OG_DHCP_API_URL": "192.168.68.51:8081",
|
||||
"OG_CORE_IP": "192.168.68.62",
|
||||
"OG_LOG_IP": "192.168.68.51",
|
||||
"UDS_AUTH_LOGIN": "test",
|
||||
"UDS_AUTH_USERNAME": "test",
|
||||
"UDS_AUTH_PASSWORD": "test",
|
||||
"UDS_URL": "https:\/\/localhost:8087\/uds\/rest\/",
|
||||
"SSL_ENABLED": "false",
|
||||
"OG_BOOT_IP": "127.0.0.1",
|
||||
"OG_BOOT_API_PORT": "8082",
|
||||
"OG_BOOT_PXE_PORT": "8082"
|
||||
"UDS_URL": "https:\/\/localhost:8087\/uds\/rest\/"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
*/5 * * * * opengnsys php -d memory_limit=512M /opt/opengnsys/ogcore/api/bin/console opengnsys:check-client-availability >> /opt/opengnsys/ogcore/api/var/log/cron.log 2>&1
|
|
@ -1,4 +1,4 @@
|
|||
SERVER_NAME=":3001"
|
||||
SERVER_NAME=":3000"
|
||||
MERCURE_PUBLISHER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
|
||||
MERCURE_SUBSCRIBER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
|
||||
MERCURE_EXTRA_DIRECTIVES="cors_origins *"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
server {
|
||||
listen 3000 ssl http2;
|
||||
listen [::]:3000 ssl http2;
|
||||
|
||||
|
||||
ssl_certificate /opt/opengnsys/ogcore/etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /opt/opengnsys/ogcore/etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3001/;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
# Enable fast reply in SSE
|
||||
proxy_buffering off;
|
||||
|
||||
## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ server {
|
|||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/ogcore-error.log;
|
||||
access_log /var/log/nginx/ogcore-access.log;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250325075647 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client ADD firmware_type VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP firmware_type');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250326061450 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command ADD parameters TINYINT(1) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command DROP parameters');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250331144522 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD datasize VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP datasize');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402060324 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image DROP version');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402081107 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_IMAGE_REPOSITORY ON image_image_repository');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_IMAGE_REPOSITORY ON image_image_repository (image_id, repository_id)');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402094550 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP version');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407063100 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD description VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP description');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407154425 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX IDX_STATUS ON client (status)');
|
||||
$this->addSql('CREATE INDEX IDX_UPDATED_AT ON client (updated_at)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX IDX_STATUS ON client');
|
||||
$this->addSql('DROP INDEX IDX_UPDATED_AT ON client');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407154620 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX IDX_STATUS_UPDATED_AT ON client (status, updated_at)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX IDX_STATUS_UPDATED_AT ON client');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250408140101 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_repository ADD user VARCHAR(255) DEFAULT NULL, ADD ssh_port VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_repository DROP user, DROP ssh_port');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250409093554 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP name');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250421122715 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD parameters LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP parameters');
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250422092348 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE network_settings ADD pxe_template_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B543BD7665C FOREIGN KEY (pxe_template_id) REFERENCES pxe_template (id)');
|
||||
$this->addSql('CREATE INDEX IDX_48869B543BD7665C ON network_settings (pxe_template_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B543BD7665C');
|
||||
$this->addSql('DROP INDEX IDX_48869B543BD7665C ON network_settings');
|
||||
$this->addSql('ALTER TABLE network_settings DROP pxe_template_id');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250422140927 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP name');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423070720 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP datetime');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD datetime DATETIME NOT NULL');
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423071243 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD organizational_unit_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE command_task ADD CONSTRAINT FK_F3D475A8FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('CREATE INDEX IDX_F3D475A8FB84408A ON command_task (organizational_unit_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP FOREIGN KEY FK_F3D475A8FB84408A');
|
||||
$this->addSql('DROP INDEX IDX_F3D475A8FB84408A ON command_task');
|
||||
$this->addSql('ALTER TABLE command_task DROP organizational_unit_id');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423092037 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_schedule (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, recurrence_type VARCHAR(255) NOT NULL, start_time DATETIME NOT NULL, recurrence_details JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', UNIQUE INDEX UNIQ_3BEA77AD17F50A6 (uuid), INDEX IDX_3BEA77A62DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD CONSTRAINT FK_3BEA77A62DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule DROP FOREIGN KEY FK_3BEA77A62DC5265');
|
||||
$this->addSql('DROP TABLE command_task_schedule');
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250427110103 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_scripts (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, content VARCHAR(255) NOT NULL, execution_order INT NOT NULL, UNIQUE INDEX UNIQ_E8950142D17F50A6 (uuid), INDEX IDX_E895014262DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_scripts ADD CONSTRAINT FK_E895014262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_command_group DROP FOREIGN KEY FK_C43618BD62DC5265');
|
||||
$this->addSql('ALTER TABLE command_task_command_group DROP FOREIGN KEY FK_C43618BDC7B800D6');
|
||||
$this->addSql('ALTER TABLE command_task_command DROP FOREIGN KEY FK_BB417CA862DC5265');
|
||||
$this->addSql('ALTER TABLE command_task_command DROP FOREIGN KEY FK_BB417CA833E1689A');
|
||||
$this->addSql('DROP TABLE command_task_command_group');
|
||||
$this->addSql('DROP TABLE command_task_command');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_command_group (command_task_id INT NOT NULL, command_group_id INT NOT NULL, INDEX IDX_C43618BD62DC5265 (command_task_id), INDEX IDX_C43618BDC7B800D6 (command_group_id), PRIMARY KEY(command_task_id, command_group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('CREATE TABLE command_task_command (command_task_id INT NOT NULL, command_id INT NOT NULL, INDEX IDX_BB417CA862DC5265 (command_task_id), INDEX IDX_BB417CA833E1689A (command_id), PRIMARY KEY(command_task_id, command_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('ALTER TABLE command_task_command_group ADD CONSTRAINT FK_C43618BD62DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command_group ADD CONSTRAINT FK_C43618BDC7B800D6 FOREIGN KEY (command_group_id) REFERENCES command_group (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command ADD CONSTRAINT FK_BB417CA862DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command ADD CONSTRAINT FK_BB417CA833E1689A FOREIGN KEY (command_id) REFERENCES command (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_scripts DROP FOREIGN KEY FK_E895014262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_scripts');
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250427125746 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_script (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, content VARCHAR(255) NOT NULL, execution_order INT NOT NULL, UNIQUE INDEX UNIQ_22BF0112D17F50A6 (uuid), INDEX IDX_22BF011262DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_script ADD CONSTRAINT FK_22BF011262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_scripts DROP FOREIGN KEY FK_E895014262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_scripts');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_scripts (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, updated_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, content VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, execution_order INT NOT NULL, INDEX IDX_E895014262DC5265 (command_task_id), UNIQUE INDEX UNIQ_E8950142D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('ALTER TABLE command_task_scripts ADD CONSTRAINT FK_E895014262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_script DROP FOREIGN KEY FK_22BF011262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_script');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428065311 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD execution_date DATE NOT NULL, ADD execution_time TIME NOT NULL, DROP start_time');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD start_time DATETIME NOT NULL, DROP execution_date, DROP execution_time');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428065937 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD enabled TINYINT(1) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule DROP enabled');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428070851 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule CHANGE execution_date execution_date DATE DEFAULT NULL, CHANGE execution_time execution_time TIME DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule CHANGE execution_date execution_date DATE NOT NULL, CHANGE execution_time execution_time TIME NOT NULL');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250429065612 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD last_execution DATETIME DEFAULT NULL, ADD next_execution DATETIME DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP last_execution, DROP next_execution');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250429091808 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD scope VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP scope');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430052434 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script ADD type VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script DROP type');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430053742 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script ADD parameters LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script DROP parameters');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430054513 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script CHANGE content content VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script CHANGE content content VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430094459 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP status');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD status VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430135412 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE git_image_repository (id INT AUTO_INCREMENT NOT NULL, image_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, status VARCHAR(255) NOT NULL, branch VARCHAR(255) NOT NULL, created TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_E6944D5ED17F50A6 (uuid), INDEX IDX_E6944D5E3DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E3DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E3DA5256D');
|
||||
$this->addSql('DROP TABLE git_image_repository');
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430140218 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD image_repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E14C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E14C736FC ON git_image_repository (image_repository_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E14C736FC');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E14C736FC ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP image_repository_id');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430140326 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP name');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250506094654 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE pxe_template ADD is_default TINYINT(1) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE pxe_template DROP is_default');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250506141057 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C74404555DA0FB8');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C74404555DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C74404555DA0FB8');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C74404555DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id)');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250508134732 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250508152437 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD type VARCHAR(255) NOT NULL, DROP description, DROP comments');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD description VARCHAR(255) DEFAULT NULL, ADD comments VARCHAR(255) DEFAULT NULL, DROP type');
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512071804 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E14C736FC');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E14C736FC ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD tag VARCHAR(255) NOT NULL, CHANGE image_repository_id repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E50C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E50C9D4F7 ON git_image_repository (repository_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E50C9D4F7');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E50C9D4F7 ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP tag, CHANGE repository_id image_repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E14C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E14C736FC ON git_image_repository (image_repository_id)');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512075927 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository CHANGE branch branch VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository CHANGE branch branch VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512081045 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP version');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250513050921 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD description VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP description');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250513055057 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD partition_info VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP partition_info');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250514051344 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client ADD token VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP token');
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250514101117 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON command (name)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_NAME ON command');
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250604084222 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id)');
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
use Symfony\Component\Mercure\Update;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:check-client-availability', description: 'Check client availability')]
|
||||
class CheckClientAvailability extends Command
|
||||
{
|
||||
const int THRESHOLD_MINUTES = 1;
|
||||
|
||||
public function __construct(
|
||||
private readonly HubInterface $hub,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$threshold = (new \DateTime())->modify(' - '.self::THRESHOLD_MINUTES . ' minutes');
|
||||
$startQueryTime = microtime(true);
|
||||
|
||||
$validStatuses = [ClientStatus::OG_LIVE, ClientStatus::WINDOWS, ClientStatus::LINUX, ClientStatus::MACOS];
|
||||
|
||||
$query = $this->entityManager->createQuery(
|
||||
'UPDATE App\Entity\Client c
|
||||
SET c.status = :status
|
||||
WHERE c.status IN (:currentStatuses)
|
||||
AND c.updatedAt < :threshold'
|
||||
);
|
||||
$query->setParameter('status', ClientStatus::DISCONNECTED);
|
||||
$query->setParameter('currentStatuses', $validStatuses);
|
||||
$query->setParameter('threshold', $threshold);
|
||||
$updatedCount = $query->execute();
|
||||
|
||||
$queryTime = microtime(true) - $startQueryTime;
|
||||
|
||||
$startMercureTime = microtime(true);
|
||||
|
||||
$clients = $this->entityManager->createQueryBuilder()
|
||||
->select('c')
|
||||
->from(Client::class, 'c')
|
||||
->where('c.status = :status')
|
||||
->andWhere('c.updatedAt < :threshold')
|
||||
->setParameter('status', ClientStatus::DISCONNECTED)
|
||||
->setParameter('threshold', $threshold)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$this->dispatchMercureEvent($clients);
|
||||
|
||||
$mercureTime = microtime(true) - $startMercureTime;
|
||||
|
||||
$io->success("Updated $updatedCount clients to DISCONNECTED status.");
|
||||
$io->note("Query time: " . round($queryTime, 3) . "s");
|
||||
$io->note("Mercure dispatch time: " . round($mercureTime, 3) . "s");
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function dispatchMercureEvent(array $clients, int $chunkSize = 10000): void
|
||||
{
|
||||
$chunks = array_chunk($clients, $chunkSize);
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
$data = [];
|
||||
|
||||
foreach ($chunk as $client) {
|
||||
$data[] = [
|
||||
'@id' => '/clients/' . $client->getUuid(),
|
||||
'status' => $client->getStatus(),
|
||||
];
|
||||
}
|
||||
|
||||
$update = new Update(
|
||||
'clients',
|
||||
json_encode($data)
|
||||
);
|
||||
|
||||
$this->hub->publish($update);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,8 +20,6 @@ class LoadDefaultUserAdminCommand extends Command
|
|||
CONST string PLAIN_PASSWORD = '12345678';
|
||||
const string USERNAME = 'ogadmin';
|
||||
|
||||
const string DEFAULT_GROUPS_VIEW = 'card';
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
|
@ -39,7 +37,6 @@ class LoadDefaultUserAdminCommand extends Command
|
|||
|
||||
$user = new User();
|
||||
$user->setUsername(self::USERNAME);
|
||||
$user->setGroupsView(self::DEFAULT_GROUPS_VIEW);
|
||||
$user->setRoles([UserGroupPermissions::ROLE_SUPER_ADMIN]);
|
||||
$user->setPassword($hash);
|
||||
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Controller\OgAgent\DeployImageAction;
|
||||
use App\Controller\OgAgent\RunScriptAction;
|
||||
use App\Dto\Input\CommandExecuteInput;
|
||||
use App\Dto\Input\DeployImageInput;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Entity\CommandTask;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Repository\CommandTaskRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:run-scheduled-command-tasks', description: 'Run scheduled command tasks')]
|
||||
class RunScheduledCommandTasksCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CommandTaskRepository $commandTaskRepository,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly RunScriptAction $runScriptAction,
|
||||
private readonly DeployImageAction $deployImageAction,
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @throws TransportExceptionInterface
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$now = new \DateTimeImmutable('now +2 hours');
|
||||
$now->setTimezone(new \DateTimeZone('Europe/Madrid'));
|
||||
$nowMinute = $now->format('Y-m-d H:i');
|
||||
|
||||
$tasks = $this->commandTaskRepository->findAll();
|
||||
|
||||
foreach ($tasks as $task) {
|
||||
/** @var CommandTask $task */
|
||||
$nextExecution = $task->getNextExecution();
|
||||
if (!$nextExecution) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$taskMinute = $nextExecution->format('Y-m-d H:i');
|
||||
|
||||
if ($taskMinute === $nowMinute) {
|
||||
$output->writeln("Ejecutando tarea: " . $task->getName());
|
||||
|
||||
$scripts = $task->getCommandTaskScripts()->toArray();
|
||||
usort($scripts, fn($a, $b) => $a->getExecutionOrder() <=> $b->getExecutionOrder());
|
||||
|
||||
foreach ($scripts as $script) {
|
||||
$output->writeln(" - Ejecutando script de tipo {$script->getType()} con orden {$script->getExecutionOrder()}");
|
||||
|
||||
if ($script->getType() === 'run-script') {
|
||||
$input = new CommandExecuteInput();
|
||||
|
||||
foreach ($task->getOrganizationalUnit()?->getClients() as $client) {
|
||||
if ($client->getStatus() !== ClientStatus::OG_LIVE) {
|
||||
continue;
|
||||
}
|
||||
$input->clients[] = new ClientOutput($client);
|
||||
}
|
||||
$input->script = $script->getContent();
|
||||
|
||||
$this->runScriptAction->__invoke($input);
|
||||
}
|
||||
}
|
||||
|
||||
$task->setLastExecution(new \DateTime());
|
||||
$task->setNextExecution($task->calculateNextExecutionDate());
|
||||
$this->entityManager->persist($task);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
use Symfony\Component\Mercure\Update;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:test', description: 'Hello PhpStorm')]
|
||||
class TestCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HubInterface $hub,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->find(7236);
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setProgress(1000);
|
||||
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
|
||||
class AuthValidatorController extends AbstractController
|
||||
{
|
||||
private JWTTokenManagerInterface $jwtManager;
|
||||
|
||||
public function __construct(JWTTokenManagerInterface $jwtManager)
|
||||
{
|
||||
$this->jwtManager = $jwtManager;
|
||||
}
|
||||
|
||||
#[Route('/validate', name: 'auth_validate', methods: ['POST'])]
|
||||
public function validate(Request $request): Response
|
||||
{
|
||||
$sslClientVerify = $request->headers->get('SSL_CLIENT_VERIFY');
|
||||
$clientCertOk = $sslClientVerify === 'SUCCESS';
|
||||
|
||||
$authHeader = $request->headers->get('Authorization');
|
||||
$hasValidJwt = $this->validateJwtToken($authHeader);
|
||||
|
||||
if ($clientCertOk || $hasValidJwt) {
|
||||
return new Response('Authorized', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
return new Response('Unauthorized', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
private function validateJwtToken(?string $authHeader): bool
|
||||
{
|
||||
if (!$authHeader || !str_starts_with($authHeader, 'Bearer ')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$token = substr($authHeader, 7);
|
||||
|
||||
try {
|
||||
$payload = $this->jwtManager->parse($token);
|
||||
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\OgBoot\PxeBootFile\PostAction;
|
||||
use App\Dto\Input\ChangeOrganizationalUnitInput;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Entity\Client;
|
||||
use App\Repository\ClientRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -12,37 +10,29 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class ChangeOrganizationalUnitAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private PostAction $postAction,
|
||||
private readonly ClientRepository $clientRepository,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(ChangeOrganizationalUnitInput $input): JsonResponse
|
||||
{
|
||||
foreach ($input->clients as $client) {
|
||||
/** @var Client $clientEntity */
|
||||
$clientEntity = $client->getEntity();
|
||||
/** @var Client $client */
|
||||
$clientEntity = $this->clientRepository->find($client->getEntity()->getId());
|
||||
if (!$clientEntity) {
|
||||
throw new NotFoundHttpException('Client not found');
|
||||
}
|
||||
|
||||
$organizationalUnit = $input->organizationalUnit->getEntity();
|
||||
$clientEntity->setOrganizationalUnit($organizationalUnit);
|
||||
|
||||
$this->entityManager->persist($clientEntity);
|
||||
$this->postAction->__invoke($clientEntity, $clientEntity->getTemplate());
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
|
|
@ -55,7 +55,6 @@ class DeployImageAction extends AbstractController
|
|||
'method' => $input->method,
|
||||
'client' => $client->getEntity()->getUuid(),
|
||||
'image' => $image->getUuid(),
|
||||
'imageName' => $image->getName(),
|
||||
'numDisk' => (string) $input->diskNumber,
|
||||
'numPartition' => (string) $input->partitionNumber,
|
||||
];
|
||||
|
@ -88,7 +87,7 @@ class DeployImageAction extends AbstractController
|
|||
];
|
||||
|
||||
try {
|
||||
$this->deployImageOgRepositoryAction->__invoke($input, $image, $client->getEntity());
|
||||
$this->deployImageOgRepositoryAction->__invoke($input, $image, $client->getEntity(), $this->httpClient);
|
||||
} catch (\Exception $e) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Controller\OgRepository\Git\CreateRepositoryAction;
|
||||
use App\Controller\OgRepository\Git\CreateTagAction;
|
||||
use App\Service\CreatePartitionService;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
#[AsController]
|
||||
abstract class AbstractOgAgentController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreatePartitionService $createPartitionService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly CreateRepositoryAction $createRepositoryAction,
|
||||
protected readonly CreateTagAction $createTagAction,
|
||||
#[Autowire(env: 'SSL_ENABLED')]
|
||||
private readonly string $sslEnabled,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function createRequest(string $method, string $url, array $params = [], string $token = null): array
|
||||
{
|
||||
$params = array_merge($params, [
|
||||
'headers' => [
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => $token,
|
||||
],
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'timeout' => 10
|
||||
]);
|
||||
|
||||
|
||||
if ($this->sslEnabled === 'true') {
|
||||
$params['verify_peer'] = true;
|
||||
$params['verify_host'] = false;
|
||||
$params['cafile'] = '/opt/opengnsys/ogcore/etc/certificates/ca.crt';
|
||||
$params['local_cert'] = '/opt/opengnsys/ogcore/etc/certificates/ogcore.crt';
|
||||
$params['local_pk'] = '/opt/opengnsys/ogcore/etc/certificates/ogcore.key';
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $this->httpClient->request($method, $url, $params);
|
||||
return json_decode($response->getContent(), true);
|
||||
} catch (ClientExceptionInterface | ServerExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('Client/Server error in request to %s: %s', $url, $e->getMessage()));
|
||||
|
||||
return [
|
||||
'code' => Response::HTTP_INTERNAL_SERVER_ERROR,
|
||||
'error' => 'Client/Server error',
|
||||
'details' => $e->getMessage(),
|
||||
];
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('Transport error in request to %s: %s', $url, $e->getMessage()));
|
||||
|
||||
return [
|
||||
'code' => Response::HTTP_INTERNAL_SERVER_ERROR,
|
||||
'error' => 'Transport error',
|
||||
'details' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,15 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Controller\OgRepository\Git\CreateRepositoryAction;
|
||||
use App\Controller\OgRepository\Git\CreateTagAction;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\GitImageRepository;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Entity\ImageRepository;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
|
@ -26,7 +21,6 @@ use Psr\Log\LoggerInterface;
|
|||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -35,67 +29,15 @@ use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class CreateImageAction extends AbstractOgAgentController
|
||||
class CreateImageAction extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(Image $image, ?Partition $partition = null, ?Client $client = null): JsonResponse
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
if (!$image->getClient()->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
$partitionInfo = [];
|
||||
|
||||
if ($partition) {
|
||||
$partitionInfo["numPartition"] = $partition->getPartitionNumber();
|
||||
$partitionInfo["numDisk"] = $partition->getDiskNumber();
|
||||
$partitionInfo["partitionCode"] = $partition->getPartitionCode();
|
||||
$partitionInfo["filesystem"] = $partition->getFilesystem();
|
||||
$partitionInfo["osName"] = $partition->getOperativeSystem()?->getName();
|
||||
$image->setPartitionInfo(json_encode($partitionInfo));
|
||||
} else {
|
||||
$partitionInfo = json_decode($image->getPartitionInfo(), true);
|
||||
}
|
||||
|
||||
if ($image->getType() === 'monolithic') {
|
||||
$repository = $image->getClient()->getRepository();
|
||||
$latestImageRepo = $this->entityManager->getRepository(ImageImageRepository::class)->findLatestVersionByImageAndRepository($image, $repository);
|
||||
|
||||
$imageImageRepository = new ImageImageRepository();
|
||||
$imageImageRepository->setName($image->getName().'_v'.($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1));
|
||||
$imageImageRepository->setImage($image);
|
||||
$imageImageRepository->setRepository($repository);
|
||||
$imageImageRepository->setStatus(ImageStatus::IN_PROGRESS);
|
||||
$imageImageRepository->setVersion($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1);
|
||||
$imageImageRepository->setPartitionInfo(json_encode($partitionInfo));
|
||||
|
||||
$this->entityManager->persist($imageImageRepository);
|
||||
|
||||
return $this->createMonolithicImage($imageImageRepository, $partitionInfo, $image, $repository, $client);
|
||||
} else {
|
||||
$repository = $image->getClient()->getRepository();
|
||||
$latestImageRepo = $this->entityManager->getRepository(GitImageRepository::class)->findLatestVersionByImageAndRepository($image, $repository);
|
||||
|
||||
$gitImageRepository = new GitImageRepository();
|
||||
$gitImageRepository->setName($image->getName().'_v'.($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1));
|
||||
$gitImageRepository->setImage($image);
|
||||
$gitImageRepository->setRepository($repository);
|
||||
$gitImageRepository->setStatus(ImageStatus::IN_PROGRESS);
|
||||
$gitImageRepository->setVersion($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1);
|
||||
$gitImageRepository->setTag('v'.($latestImageRepo ? $latestImageRepo->getVersion() + 1 : 1));
|
||||
$gitImageRepository->setCreated(false);
|
||||
|
||||
$this->entityManager->persist($gitImageRepository);
|
||||
$this->entityManager->persist($image);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->createGitImage($gitImageRepository, $partitionInfo, $image, $repository);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,20 +46,29 @@ class CreateImageAction extends AbstractOgAgentController
|
|||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function createMonolithicImage(
|
||||
ImageImageRepository $imageImageRepository,
|
||||
array $partitionInfo,
|
||||
Image $image,
|
||||
ImageRepository $repository,
|
||||
?Client $client = null
|
||||
): JsonResponse
|
||||
public function __invoke(Image $image): JsonResponse
|
||||
{
|
||||
if (!$image->getClient()->getIp()) {
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
$partitionInfo = json_decode($image->getPartitionInfo(), true);
|
||||
|
||||
$repository = $image->getClient()->getRepository();
|
||||
|
||||
$imageImageRepository = new ImageImageRepository();
|
||||
$imageImageRepository->setImage($image);
|
||||
$imageImageRepository->setRepository($repository);
|
||||
$imageImageRepository->setStatus(ImageStatus::IN_PROGRESS);
|
||||
|
||||
$this->entityManager->persist($imageImageRepository);
|
||||
|
||||
$data = [
|
||||
'dsk' => (string) $partitionInfo['numDisk'],
|
||||
'par' => (string) $partitionInfo['numPartition'],
|
||||
'cpt' => null,
|
||||
'idi' => $imageImageRepository->getUuid(),
|
||||
'nci' => $image->getName().'_v'.$imageImageRepository->getVersion(),
|
||||
'nci' => $image->getName(),
|
||||
'ipr' => $repository->getIp(),
|
||||
'nfn' => 'CrearImagen',
|
||||
'ids' => '0'
|
||||
|
@ -137,82 +88,35 @@ class CreateImageAction extends AbstractOgAgentController
|
|||
throw new Exception("El tipo de partición '$partitionCode' no se encontró en la lista.");
|
||||
}
|
||||
|
||||
$client = $client ?? $image->getClient();
|
||||
$this->logger->info('Creating image', ['image' => $image->getId()]);
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/CrearImagen',
|
||||
params: [
|
||||
try {
|
||||
$this->logger->info('Creating image', ['image' => $image->getId()]);
|
||||
$response = $this->httpClient->request('POST', 'https://'.$image->getClient()->getIp().':8000/CloningEngine/CrearImagen', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
]);
|
||||
|
||||
$this->logger->info('Creating image', ['image' => $imageImageRepository->getName(), 'repository' => $repository->getIp()]);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error creating image');
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error('Error creating image', ['image' => $image->getId(), 'error' => $e->getMessage()]);
|
||||
return new JsonResponse(
|
||||
data: ['error' => $e->getMessage()],
|
||||
status: Response::HTTP_INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
$jobId = json_decode($response->getContent(), true)['job_id'];
|
||||
|
||||
$client = $image->getClient();
|
||||
$client->setStatus(ClientStatus::BUSY);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$inputData = [
|
||||
'method' => 'CrearImagen',
|
||||
'type' => 'monolithic',
|
||||
'client' => $client->getUuid(),
|
||||
'image' => $image->getUuid(),
|
||||
'partitionCode' => $partitionInfo['partitionCode'],
|
||||
'partitionType' => $partitionInfo['filesystem'],
|
||||
'repository' => $repository->getIp(),
|
||||
'name' => $image->getName().'_v'.$imageImageRepository->getVersion(),
|
||||
];
|
||||
|
||||
$this->createService->__invoke($image->getClient(), CommandTypes::CREATE_IMAGE, TraceStatus::IN_PROGRESS, $jobId, $inputData);
|
||||
$this->createService->__invoke($image->getClient(), CommandTypes::CREATE_IMAGE, TraceStatus::IN_PROGRESS, $jobId, []);
|
||||
|
||||
return new JsonResponse(data: $image, status: Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function createGitImage(
|
||||
GitImageRepository $gitImageRepository,
|
||||
array $partitionInfo,
|
||||
Image $image,
|
||||
ImageRepository $repository
|
||||
): JsonResponse
|
||||
{
|
||||
if (!isset($partitonInfo)) {
|
||||
try {
|
||||
$this->createRepositoryAction->__invoke($image, $repository);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error('Error creating repository', ['repository' => $repository->getId(), 'error' => $e->getMessage()]);
|
||||
|
||||
return new JsonResponse(
|
||||
data: ['error' => $e->getMessage()],
|
||||
status: Response::HTTP_INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$this->createTagAction->__invoke($image, $repository, $gitImageRepository);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error('Error creating tag', ['repository' => $repository->getId(), 'error' => $e->getMessage()]);
|
||||
|
||||
return new JsonResponse(
|
||||
data: ['error' => $e->getMessage()],
|
||||
status: Response::HTTP_INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResponse(
|
||||
data: ['message' => 'Repository created successfully'],
|
||||
status: Response::HTTP_OK
|
||||
);
|
||||
|
||||
//TODO: llamar al endpoint del agente.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -30,8 +29,17 @@ use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class DeployImageAction extends AbstractOgAgentController
|
||||
class DeployImageAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
|
@ -43,7 +51,7 @@ class DeployImageAction extends AbstractOgAgentController
|
|||
$image = $imageImageRepository->getImage();
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
$method = match ($input->method) {
|
||||
|
@ -52,7 +60,7 @@ class DeployImageAction extends AbstractOgAgentController
|
|||
DeployMethodTypes::UNICAST_DIRECT => 'unicast-direct',
|
||||
DeployMethodTypes::UNICAST => 'unicast',
|
||||
DeployMethodTypes::TORRENT => 'torrent',
|
||||
default => throw new BadRequestHttpException('Invalid method'),
|
||||
default => throw new ValidatorException('Invalid method'),
|
||||
};
|
||||
|
||||
$mcastMode = $input->mcastMode.'-duplex';
|
||||
|
@ -66,7 +74,7 @@ class DeployImageAction extends AbstractOgAgentController
|
|||
DeployMethodTypes::MULTICAST, DeployMethodTypes::MULTICAST_UFTP, DeployMethodTypes::MULTICAST_UFTP_DIRECT, DeployMethodTypes::MULTICAST_UDPCAST, DeployMethodTypes::MULTICAST_UDPCAST_DIRECT => $ptcMulticastValue,
|
||||
DeployMethodTypes::UNICAST, DeployMethodTypes::UNICAST_DIRECT => $ptcUnicastValue,
|
||||
DeployMethodTypes::TORRENT => $ptcTorrentValue,
|
||||
default => throw new BadRequestHttpException('Invalid method'),
|
||||
default => throw new ValidatorException('Invalid method'),
|
||||
};
|
||||
|
||||
$repository = $imageImageRepository->getRepository();
|
||||
|
@ -76,29 +84,33 @@ class DeployImageAction extends AbstractOgAgentController
|
|||
'par' => (string) $input->partitionNumber,
|
||||
'ifs' => "1",
|
||||
'idi' => $image->getUuid(),
|
||||
'nci' => $imageImageRepository->getName(),
|
||||
'nci' => $image->getName(),
|
||||
'ipr' => $repository->getIp(),
|
||||
'nfn' => 'RestaurarImagen',
|
||||
'ptc' => $ptcValue,
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/RestaurarImagen',
|
||||
params: [
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/CloningEngine/RestaurarImagen', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
]);
|
||||
$this->logger->info('Deploying image', ['image' => $image->getId()]);
|
||||
|
||||
$this->logger->info('Deploying image', [ 'image' => $imageImageRepository->getName(), 'repository' => $repository->getIp()]);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error deploying image');
|
||||
$jobId = json_decode($response->getContent(), true)['job_id'];
|
||||
} catch (ClientExceptionInterface | ServerExceptionInterface | TransportExceptionInterface | TransportException $e) {
|
||||
$this->logger->error('Error deploying image', [
|
||||
'image' => $image->getId() ?? 'unknown',
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$client->setStatus(ClientStatus::BUSY);
|
||||
$this->entityManager->persist($client);
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class HardwareInventoryAction extends AbstractOgAgentController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(Client $client): JsonResponse
|
||||
{
|
||||
$data = [
|
||||
'nfn' => 'InventarioHardware',
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/InventarioHardware',
|
||||
params: [
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error performing hardware inventory: '.$response['error']);
|
||||
}
|
||||
|
||||
$this->logger->info('Login client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$inputData = [
|
||||
'client' => $client->getIp(),
|
||||
];
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::HARDWARE_INVENTORY, TraceStatus::IN_PROGRESS, $jobId, $inputData);
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Dto\Input\BootClientsInput;
|
||||
use App\Dto\Input\MultipleClientsInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\ImageStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class LoginAction extends AbstractOgAgentController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(BootClientsInput $input): JsonResponse
|
||||
{
|
||||
/** @var Partition $partition */
|
||||
$partition = $input->partition->getEntity();
|
||||
|
||||
foreach ($input->clients as $clientEntity) {
|
||||
/** @var Client $client */
|
||||
$client = $clientEntity->getEntity();
|
||||
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
if ($client->getStatus() !== ClientStatus::OG_LIVE) {
|
||||
throw new BadRequestHttpException('Client is not in OG_LIVE status');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nfn' => 'IniciarSesion',
|
||||
'dsk' => (string) $partition->getDiskNumber(),
|
||||
'par' => (string) $partition->getPartitionNumber(),
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/IniciarSesion',
|
||||
params: [
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error logging in: '.$response['error']);
|
||||
}
|
||||
|
||||
$this->logger->info('Login client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$client->setStatus(ClientStatus::INITIALIZING);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::LOGIN, TraceStatus::SUCCESS, $jobId, []);
|
||||
}
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ use Psr\Log\LoggerInterface;
|
|||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -29,24 +28,26 @@ use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class PartitionAssistantAction extends AbstractOgAgentController
|
||||
class PartitionAssistantAction extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(PartitionPostInput $input): JsonResponse
|
||||
{
|
||||
$partitions = $input->partitions;
|
||||
|
||||
if (empty($partitions)) {
|
||||
throw new BadRequestHttpException('Partitions is required');
|
||||
throw new ValidatorException('Partitions is required');
|
||||
}
|
||||
|
||||
foreach ($input->clients as $clientInput) {
|
||||
/** @var Client $client */
|
||||
$client = $clientInput->getEntity();
|
||||
|
||||
$disks = [];
|
||||
|
@ -71,10 +72,13 @@ class PartitionAssistantAction extends AbstractOgAgentController
|
|||
];
|
||||
}
|
||||
|
||||
$disks[$diskNumber]['diskData'] = [
|
||||
'dis' => (string) $diskNumber,
|
||||
'tch' => (string) ($partition->size * 1024),
|
||||
];
|
||||
if ($partition->filesystem === 'CACHE') {
|
||||
$disks[$diskNumber]['diskData'] = [
|
||||
'dis' => (string) $diskNumber,
|
||||
'che' => "0",
|
||||
'tch' => (string) ($partition->size * 1024),
|
||||
];
|
||||
}
|
||||
|
||||
$disks[$diskNumber]['partitionData'][] = [
|
||||
'par' => (string) $partition->partitionNumber,
|
||||
|
@ -99,31 +103,32 @@ class PartitionAssistantAction extends AbstractOgAgentController
|
|||
"ids" => "0"
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/Configurar',
|
||||
params: [
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/CloningEngine/Configurar', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => $result,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
$this->logger->info('Partition assistant', ['client' => $client->getId()]);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error occurred while partitioning');
|
||||
]);
|
||||
$this->logger->info('Partitioning disk', ['client' => $client->getId(), 'disk' => $diskNumber]);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error('Error partitioning disk', ['client' => $client->getId(), 'disk' => $diskNumber, 'error' => $e->getMessage()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
$jobId = json_decode($response->getContent(), true)['job_id'];
|
||||
|
||||
$client->setStatus(ClientStatus::BUSY);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::PARTITION_AND_FORMAT, TraceStatus::IN_PROGRESS, $jobId, $data);
|
||||
$this->createService->__invoke($client, CommandTypes::PARTITION_AND_FORMAT, TraceStatus::IN_PROGRESS, $jobId, []);
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -29,14 +28,17 @@ use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class PowerOffAction extends AbstractOgAgentController
|
||||
class PowerOffAction extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(MultipleClientsInput $input): JsonResponse
|
||||
{
|
||||
foreach ($input->clients as $clientEntity) {
|
||||
|
@ -44,37 +46,38 @@ class PowerOffAction extends AbstractOgAgentController
|
|||
$client = $clientEntity->getEntity();
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
if ($client->getStatus() === ClientStatus::OFF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$endpoint = $client->getStatus() === ClientStatus::OG_LIVE ? 'opengnsys/Apagar' : 'opengnsys/poweroff';
|
||||
|
||||
$data = [
|
||||
'nfn' => 'Apagar',
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/'.$endpoint,
|
||||
params: [
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/Apagar', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
]);
|
||||
$this->logger->info('Powering off client', ['client' => $client->getId()]);
|
||||
$jobId = json_decode($response->getContent(), true)['job_id'];
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error deploying image');
|
||||
} catch (ClientExceptionInterface | ServerExceptionInterface | TransportExceptionInterface | TransportException $e) {
|
||||
$this->logger->error('Error power off client', [
|
||||
'image' => $client->getIp(),
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->logger->info('Powering off client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$client->setStatus(ClientStatus::TURNING_OFF);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
|
|
@ -19,7 +19,6 @@ use Psr\Log\LoggerInterface;
|
|||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -28,48 +27,52 @@ use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class RebootAction extends AbstractOgAgentController
|
||||
class RebootAction extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(MultipleClientsInput $input): JsonResponse
|
||||
{
|
||||
foreach ($input->clients as $clientEntity) {
|
||||
/** @var Client $client */
|
||||
$client = $clientEntity->getEntity();
|
||||
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
$endpoint = $client->getStatus() === ClientStatus::OG_LIVE ? 'opengnsys/Reiniciar' : '/opengnsys/reboot';
|
||||
|
||||
$data = [
|
||||
'nfn' => 'Reiniciar',
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/'.$endpoint,
|
||||
params: [
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/Reiniciar', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
]);
|
||||
$this->logger->info('Rebooting client', ['client' => $client->getId()]);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error deploying image');
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error('Error rebooting client', ['client' => $client->getId(), 'error' => $e->getMessage()]);
|
||||
return new JsonResponse(
|
||||
data: ['error' => $e->getMessage()],
|
||||
status: Response::HTTP_INTERNAL_SERVER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
$this->logger->info('Rebooting client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
$jobId = json_decode($response->getContent(), true)['job_id'];
|
||||
|
||||
$client->setStatus(ClientStatus::INITIALIZING);
|
||||
$this->entityManager->persist($client);
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Dto\Input\BootClientsInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Partition;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class RemoveCacheImageAction extends AbstractOgAgentController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(BootClientsInput $input): JsonResponse
|
||||
{
|
||||
/** @var Partition $partition */
|
||||
$partition = $input->partition->getEntity();
|
||||
|
||||
foreach ($input->clients as $clientEntity) {
|
||||
/** @var Client $client */
|
||||
$client = $clientEntity->getEntity();
|
||||
|
||||
if (!$partition->getImage()) {
|
||||
throw new BadRequestHttpException('Image is required');
|
||||
}
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
if ($client->getStatus() !== ClientStatus::OG_LIVE) {
|
||||
throw new BadRequestHttpException('Client is not in OG_LIVE status');
|
||||
}
|
||||
|
||||
$script = `rm%20-r%20/opt/opengnsys/cache/opt/opengnsys/images/{$partition->getImage()->getName()}.*@'`;
|
||||
|
||||
$data = [
|
||||
'nfn' => 'EjecutarScript',
|
||||
'scp' => base64_encode($script),
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/EjecutarScript',
|
||||
params: [
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error logging in: '.$response['error']);
|
||||
}
|
||||
|
||||
$this->logger->info('Login client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$inputData = [
|
||||
'script' => $script,
|
||||
];
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::RUN_SCRIPT, TraceStatus::SUCCESS, $jobId, $inputData);
|
||||
}
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Dto\Input\CommandExecuteInput;
|
||||
use App\Dto\Input\MultipleClientsInput;
|
||||
use App\Entity\Client;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class RunScriptAction extends AbstractOgAgentController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(CommandExecuteInput $input): JsonResponse
|
||||
{
|
||||
/** @var Client $clientEntity */
|
||||
foreach ($input->clients as $clientEntity) {
|
||||
/** @var Client $client */
|
||||
$client = $clientEntity->getEntity();
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nfn' => 'EjecutarScript',
|
||||
'scp' => base64_encode($input->script),
|
||||
'ids' => '0'
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/EjecutarScript',
|
||||
params: [
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error deploying image');
|
||||
}
|
||||
|
||||
$this->logger->info('Powering off client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$inputData = [
|
||||
'script' => $input->script,
|
||||
];
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::RUN_SCRIPT, TraceStatus::IN_PROGRESS, $jobId, $inputData);
|
||||
}
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Dto\Input\SoftwareInventoryPartitionInput;
|
||||
use App\Entity\Client;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class SoftwareInventoryAction extends AbstractOgAgentController
|
||||
{
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(Client $client, SoftwareInventoryPartitionInput $input): JsonResponse
|
||||
{
|
||||
$data = [
|
||||
'nfn' => 'InventarioSoftware',
|
||||
'ids' => '0',
|
||||
'dsk' => (string) $input->partition->getEntity()->getDiskNumber(),
|
||||
'par' => (string) $input->partition->getEntity()->getPartitionNumber(),
|
||||
];
|
||||
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/InventarioSoftware',
|
||||
params: [
|
||||
'json' => $data,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['error']) && $response['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error performing software inventory: '.$response['error']);
|
||||
}
|
||||
|
||||
$this->logger->info('Login client', ['client' => $client->getId()]);
|
||||
|
||||
$jobId = $response['job_id'];
|
||||
|
||||
$inputData = [
|
||||
'partition' => $input->partition->getEntity()->getUuid(),
|
||||
'image' => $input->partition->getEntity()->getImage()?->getUuid(),
|
||||
'client' => $client->getIp(),
|
||||
];
|
||||
|
||||
$this->createService->__invoke($client, CommandTypes::SOFTWARE_INVENTORY, TraceStatus::IN_PROGRESS, $jobId, $inputData);
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@ use Symfony\Component\HttpClient\Internal\ClientState;
|
|||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
|
@ -25,8 +24,15 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
#[AsController]
|
||||
class StatusAction extends AbstractOgAgentController
|
||||
class StatusAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreatePartitionService $createPartitionService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
|
@ -38,7 +44,7 @@ class StatusAction extends AbstractOgAgentController
|
|||
$response = null;
|
||||
|
||||
if (!$client->getIp()) {
|
||||
throw new BadRequestHttpException('IP is required');
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
if ($client->getStatus() === ClientStatus::OG_LIVE
|
||||
|
@ -60,66 +66,64 @@ class StatusAction extends AbstractOgAgentController
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function getOgLiveStatus (Client $client): JsonResponse|int|string
|
||||
{
|
||||
$this->logger->info('Checking client status', ['client' => $client->getId()]);
|
||||
|
||||
$params = [
|
||||
'json' => [
|
||||
'full-config' => false
|
||||
]
|
||||
];
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'timeout' => 30,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => [],
|
||||
]);
|
||||
$statusCode = $response->getStatusCode();
|
||||
$client->setStatus($statusCode === Response::HTTP_OK ? ClientStatus::OG_LIVE : ClientStatus::OFF);
|
||||
|
||||
$data = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://' . $client->getIp() . ':8000/opengnsys/status',
|
||||
params: $params,
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($data['error']) && $data['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
$this->logger->error('Error checking client status', ['client' => $client->getId()]);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error('Error checking client status', ['client' => $client->getId(), 'error' => $e->getMessage()]);
|
||||
$client->setStatus(ClientStatus::OFF);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
throw new BadRequestHttpException('Error checking client status: ' . $data['error'] . ' (' . $data['details'] . ')');
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
$data = json_decode($response->getContent(), true);
|
||||
|
||||
if (isset($data['cfg'])) {
|
||||
$this->logger->info('Creating partitions', ['data' => $data['cfg']]);
|
||||
$this->createPartitionService->__invoke($data, $client);
|
||||
}
|
||||
|
||||
$client->setStatus(ClientStatus::OG_LIVE);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Response::HTTP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function getSOStatus (Client $client): JsonResponse|int
|
||||
{
|
||||
$data = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://' . $client->getIp() . ':8000/opengnsys/status',
|
||||
params: [
|
||||
'full-config' => false,
|
||||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/opengnsys/status', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => [],
|
||||
]);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$client->setStatus(ClientStatus::OFF);
|
||||
$this->logger->error('Error checking client status', ['client' => $client->getId(), 'error' => $e->getMessage()]);
|
||||
return Response::HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
$data = json_decode($response->getContent(), true);
|
||||
|
||||
if (isset($data['cfg'])) {
|
||||
$this->createPartitionService->__invoke($data, $client);
|
||||
|
|
|
@ -49,7 +49,6 @@ class AgentController extends AbstractController
|
|||
}
|
||||
|
||||
$clientEntity->setStatus(ClientStatus::OG_LIVE);
|
||||
$clientEntity->setToken($data['secret'] ?? null);
|
||||
$this->entityManager->persist($clientEntity);
|
||||
|
||||
if (isset($data['cfg'])) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Controller\OgAgent\Webhook;
|
||||
|
||||
use App\Controller\OgRepository\Image\CreateAuxFilesAction;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Entity\OperativeSystem;
|
||||
|
@ -33,14 +32,12 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
#[AsController]
|
||||
class StatusController extends AbstractController
|
||||
class ClientsController extends AbstractController
|
||||
{
|
||||
const string CREATE_IMAGE = 'RESPUESTA_CrearImagen';
|
||||
const string RESTORE_IMAGE = 'RESPUESTA_RestaurarImagen';
|
||||
const string CONFIGURE_IMAGE = 'RESPUESTA_Configurar';
|
||||
const string HARDWARE_INVENTORY = 'RESPUESTA_InventarioHardware';
|
||||
const string SOFTWARE_INVENTORY = 'RESPUESTA_InventarioSoftware';
|
||||
const string RUN_SCRIPT = 'RESPUESTA_EjecutarScript';
|
||||
|
||||
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
|
@ -62,26 +59,20 @@ class StatusController extends AbstractController
|
|||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
$requiredFields = ['job_id'];
|
||||
|
||||
foreach ($requiredFields as $field) {
|
||||
if (!isset($data[$field])) {
|
||||
return new JsonResponse(['message' => "Missing parameter: $field"], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->info('Webhook data received', $data);
|
||||
|
||||
// Esta parte del codigo nos indica si el cliente se encuentra activo
|
||||
if (isset($data['iph']) && isset($data['timestamp'])) {
|
||||
$client = $this->entityManager->getRepository(Client::class)->findOneBy(['ip' => $data['iph']]);
|
||||
if (!$client) {
|
||||
$this->logger->error('Client not found', $data);
|
||||
return new JsonResponse(['message' => 'Client not found'], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
$client->setUpdatedAt(new \DateTime());
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
if (isset($data['progress'])){
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
if ($trace){
|
||||
$trace->setProgress($data['progress'] * 100);
|
||||
$trace->setProgress($data['progress'] * 1000);
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
@ -161,75 +152,13 @@ class StatusController extends AbstractController
|
|||
$client->setStatus(ClientStatus::OG_LIVE);
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->persist($trace);
|
||||
|
||||
if ($data['nfn'] === self::RESTORE_IMAGE) {
|
||||
$partitionData = json_decode(json_encode($trace->getInput()), true);
|
||||
|
||||
$numDisk = (int) $partitionData['numDisk'] ?? null;
|
||||
$numPartition = (int) $partitionData['numPartition'] ?? null;
|
||||
|
||||
$imageImageRepository = $this->entityManager->getRepository(ImageImageRepository::class)->findOneBy(['uuid' => $partitionData['image']]);
|
||||
|
||||
$partition = $this->entityManager->getRepository(Partition::class)
|
||||
->findOneBy(['diskNumber' => $numDisk, 'partitionNumber' => $numPartition, 'client' => $client]);
|
||||
|
||||
if ($partition) {
|
||||
$partition->setImage($imageImageRepository);
|
||||
$this->entityManager->persist($partition);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
if (isset($data['nfn']) && $data['nfn'] === self::RUN_SCRIPT) {
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
if ($trace) {
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['nfn']) && $data['nfn'] === self::HARDWARE_INVENTORY) {
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
if ($trace) {
|
||||
$client = $trace->getClient();
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
$this->entityManager->persist($trace);
|
||||
|
||||
//$client->setHardwareProfile();
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['nfn']) && $data['nfn'] === self::SOFTWARE_INVENTORY) {
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
|
||||
if ($trace) {
|
||||
$client = $trace->getClient();
|
||||
$dataInput = json_decode(json_encode($trace->getInput()), true);
|
||||
$imageUuid = $dataInput['image'] ?? null;
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
$this->entityManager->persist($trace);
|
||||
|
||||
$image = $this->entityManager->getRepository(ImageImageRepository::class)->findOneBy(['uuid' => $imageUuid]);
|
||||
$this->createSoftwareProfile($data['contents'], $image);
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResponse(data: 'Webhook finished', status: Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function createSoftwareProfile(string $base64Data, ?ImageImageRepository $imageImageRepository = null): void
|
||||
public function createSoftwareProfile(string $base64Data, ImageImageRepository $imageImageRepository): void
|
||||
{
|
||||
$decodedData = base64_decode($base64Data);
|
||||
$this->logger->info('Software profile decoded', ['data' => '']);
|
||||
|
@ -246,10 +175,10 @@ class StatusController extends AbstractController
|
|||
$this->entityManager->persist($softwareEntity);
|
||||
}
|
||||
|
||||
$image = $imageImageRepository?->getImage();
|
||||
$image = $imageImageRepository->getImage();
|
||||
|
||||
$softwareProfile = new SoftwareProfile();
|
||||
$softwareProfile->setDescription('SW Profile - ' . $image->getClient()->getName());
|
||||
$softwareProfile->setDescription('Perfil software: ' . $image->getClient()->getName());
|
||||
$softwareProfile->setOrganizationalUnit($image->getClient()->getOrganizationalUnit());
|
||||
|
||||
foreach ($existingSoftware as $softwareEntity) {
|
|
@ -7,7 +7,6 @@ namespace App\Controller\OgAgent\Webhook;
|
|||
use App\Entity\Client;
|
||||
use App\Model\ClientStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -16,11 +15,10 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
|
|||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[AsController]
|
||||
class AgentSessionController extends AbstractController
|
||||
class OgAgentController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly LoggerInterface $logger
|
||||
protected readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
}
|
||||
|
@ -60,14 +58,6 @@ class AgentSessionController extends AbstractController
|
|||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Client started', [
|
||||
'mac' => $data['mac'],
|
||||
'ip' => $data['ip'],
|
||||
'ostype' => $data['ostype'],
|
||||
'osversion' => $data['osversion'],
|
||||
'agent_version' => $data['agent_version'],
|
||||
]);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
@ -92,13 +82,6 @@ class AgentSessionController extends AbstractController
|
|||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Client stopped', [
|
||||
'mac' => $data['mac'],
|
||||
'ip' => $data['ip'],
|
||||
'ostype' => $data['ostype'],
|
||||
'osversion' => $data['osversion'],
|
||||
]);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
@ -134,18 +117,6 @@ class AgentSessionController extends AbstractController
|
|||
return new JsonResponse(['message' => 'Invalid status'], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Client logged in', [
|
||||
'ip' => $data['ip'],
|
||||
'user' => $data['user'],
|
||||
'language' => $data['language'],
|
||||
'session' => $data['session'],
|
||||
'ostype' => $data['ostype'],
|
||||
'osversion' => $data['osversion'],
|
||||
]);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
@ -181,15 +152,6 @@ class AgentSessionController extends AbstractController
|
|||
return new JsonResponse(['message' => 'Invalid status'], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($client);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Client logged out', [
|
||||
'ip' => $data['ip'],
|
||||
'user' => $data['user'],
|
||||
'ostype' => $data['ostype'],
|
||||
]);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_OK);
|
||||
}
|
||||
}
|
|
@ -7,9 +7,8 @@ namespace App\Controller\OgBoot;
|
|||
use App\Controller\OgBoot\PxeBootFile\PostAction;
|
||||
use App\Service\Trace\CreateService;
|
||||
use App\Service\Utils\ExtractOgLiveFilenameDateService;
|
||||
use App\Service\Utils\SimplifyOgLiveFilenameService;
|
||||
use App\Service\Utils\SymflipyOgLiveFilenameService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
@ -26,12 +25,8 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|||
abstract class AbstractOgBootController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(env: 'OG_BOOT_IP')]
|
||||
protected string $ogBootIp,
|
||||
#[Autowire(env: 'OG_BOOT_PXE_PORT')]
|
||||
protected string $ogBootPxePort,
|
||||
#[Autowire(env: 'OG_BOOT_API_PORT')]
|
||||
protected string $ogBootApiPort,
|
||||
#[Autowire(env: 'OG_BOOT_API_URL')]
|
||||
protected string $ogBootApiUrl,
|
||||
#[Autowire(env: 'OG_CORE_IP')]
|
||||
protected string $ogCoreIP,
|
||||
#[Autowire(env: 'OG_LOG_IP')]
|
||||
|
@ -39,10 +34,8 @@ abstract class AbstractOgBootController extends AbstractController
|
|||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly SimplifyOgLiveFilenameService $simplifyOgLiveFilenameService,
|
||||
protected readonly SymflipyOgLiveFilenameService $symflipyOgLiveFilenameService,
|
||||
protected readonly ExtractOgLiveFilenameDateService $extractOgLiveFilenameDateService,
|
||||
protected readonly LoggerInterface $logger,
|
||||
|
||||
)
|
||||
{
|
||||
}
|
||||
|
@ -63,25 +56,15 @@ abstract class AbstractOgBootController extends AbstractController
|
|||
]);
|
||||
|
||||
try {
|
||||
$response = $this->httpClient->request($method, 'http://'.$this->ogBootIp.':'.$this->ogBootApiPort.$url, $params);
|
||||
$response = $this->httpClient->request($method, $url, $params);
|
||||
|
||||
return json_decode($response->getContent(), true);
|
||||
} catch (ClientExceptionInterface | ServerExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('Client/Server error in request to %s: %s', $url, $e->getMessage()));
|
||||
|
||||
return [
|
||||
'code' => Response::HTTP_INTERNAL_SERVER_ERROR,
|
||||
'error' => 'Client/Server error',
|
||||
'details' => $e->getMessage(),
|
||||
];
|
||||
$response = $e->getResponse();
|
||||
$content = json_decode($response->getContent(false), true);
|
||||
throw new HttpException($response->getStatusCode(), $content['error'] ?? 'An error occurred');
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error(sprintf('Transport error in request to %s: %s', $url, $e->getMessage()));
|
||||
|
||||
return [
|
||||
'code' => Response::HTTP_INTERNAL_SERVER_ERROR,
|
||||
'error' => 'Transport error',
|
||||
'details' => $e->getMessage(),
|
||||
];
|
||||
throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
|
@ -38,10 +37,6 @@ class OgBootController extends AbstractController
|
|||
{
|
||||
$data = $this->ogbootStatusService->__invoke();
|
||||
|
||||
if (isset($data['error']) && $data['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('An error occurred while fetching the status: ' . $data['details']);
|
||||
}
|
||||
|
||||
return new JsonResponse( data: $data, status: Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue