refs #1053 Modifies installer to use dinamic routes and adds backup dir to controller
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
parent
0b6e6f7893
commit
210b5ef72d
|
|
@ -1,4 +1,7 @@
|
||||||
{
|
{
|
||||||
"interfaces": ["eth0", "eth1"],
|
"interfaces": ["eth0", "eth1"],
|
||||||
"ogbootIP": "172.17.8.37"
|
"ogbootIP": "172.17.8.37",
|
||||||
|
"ogDhcpIP": "172.17.8.37",
|
||||||
|
"ogDhcp_Dir": "/opt/opengnsys/ogdhcp"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ function globalSetup() {
|
||||||
|
|
||||||
# Directorios de instalación y destino de OpenGnsys.
|
# Directorios de instalación y destino de OpenGnsys.
|
||||||
WORKDIR=/tmp/ogdhcp_installer
|
WORKDIR=/tmp/ogdhcp_installer
|
||||||
INSTALL_TARGET=/opt/ogdhcp
|
INSTALL_TARGET=$(jq -r '.ogDhcp_Dir' "$CONFIG_FILE")
|
||||||
PATH=$PATH:$INSTALL_TARGET/bin
|
PATH=$PATH:$INSTALL_TARGET/bin
|
||||||
|
|
||||||
if command -v service &>/dev/null; then
|
if command -v service &>/dev/null; then
|
||||||
|
|
@ -176,9 +176,6 @@ function createDirs() {
|
||||||
# Cambiar permisos de usuario
|
# Cambiar permisos de usuario
|
||||||
echoAndLog "Changing user permission"
|
echoAndLog "Changing user permission"
|
||||||
chown -R "$OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER" "$INSTALL_TARGET"
|
chown -R "$OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER" "$INSTALL_TARGET"
|
||||||
|
|
||||||
# Copiar .env
|
|
||||||
cp -a "$WORKDIR/ogdhcp/.env" "${path_opengnsys_base}/.env"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -376,14 +373,19 @@ add_write_permission_apparmor() {
|
||||||
|
|
||||||
# Función para configurar Nginx
|
# Función para configurar Nginx
|
||||||
setup_nginx() {
|
setup_nginx() {
|
||||||
get_first_network_interface_with_traffic
|
|
||||||
|
|
||||||
if [[ -z "$DEFAULTDEV" ]]; then
|
#ip_address_server=$(get_ip_address "$DEFAULTDEV")
|
||||||
echo "Error: No se encontró una interfaz de red activa."
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||||
|
echo "Error: El archivo de configuración no se encontró."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ip_address_server=$(get_ip_address "$DEFAULTDEV")
|
ip_address_server=$(jq -r '.ogDhcpIP' "$CONFIG_FILE")
|
||||||
|
|
||||||
|
if [[ -z "$ip_address_server" ]]; then
|
||||||
|
echo "Error: No se pudo obtener la dirección IP del servidor desde el archivo de configuración."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
php_version=$(get_php_fpm_version)
|
php_version=$(get_php_fpm_version)
|
||||||
|
|
||||||
if [[ -z "$php_version" ]]; then
|
if [[ -z "$php_version" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,11 +19,13 @@ class DhcpController
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
private $curlKeaService;
|
private $curlKeaService;
|
||||||
|
private $backup_dir;
|
||||||
|
|
||||||
public function __construct(CurlKeaService $curlKeaService, LoggerInterface $logger)
|
public function __construct(CurlKeaService $curlKeaService, LoggerInterface $logger, ParameterBagInterface $params)
|
||||||
{
|
{
|
||||||
$this->curlKeaService = $curlKeaService;
|
$this->curlKeaService = $curlKeaService;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->backup_dir = $params->get('backup_dir');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1439,7 +1442,8 @@ public function updateDhcpHost(Request $request, $subnetId): JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getLatestBackupConfiguration(): JsonResponse
|
public function getLatestBackupConfiguration(): JsonResponse
|
||||||
{
|
{
|
||||||
$backup_dir = '/opt/ogdhcp/etc/kea/backup';
|
#$backup_dir = '/opt/ogdhcp/etc/kea/backup';
|
||||||
|
$backup_dir = $this->backup_dir;
|
||||||
try {
|
try {
|
||||||
// Obtener los archivos de backup
|
// Obtener los archivos de backup
|
||||||
$backup_files = glob($backup_dir . '/*.conf');
|
$backup_files = glob($backup_dir . '/*.conf');
|
||||||
|
|
@ -1532,7 +1536,8 @@ public function getLatestBackupConfiguration(): JsonResponse
|
||||||
*/
|
*/
|
||||||
public function restoreDhcpConfiguration(): JsonResponse
|
public function restoreDhcpConfiguration(): JsonResponse
|
||||||
{
|
{
|
||||||
$backup_dir = '/opt/ogdhcp/etc/kea/backup';
|
#$backup_dir = '/opt/ogdhcp/etc/kea/backup';
|
||||||
|
$backup_dir = $this->backup_dir;
|
||||||
try {
|
try {
|
||||||
$backup_files = glob($backup_dir . '/*.conf');
|
$backup_files = glob($backup_dir . '/*.conf');
|
||||||
if (empty($backup_files)) {
|
if (empty($backup_files)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue