Compare commits

..

10 Commits

Author SHA1 Message Date
Natalia Serrano 2be41695d6 Merge pull request 'refs #2521 have CrearImagenGit not receive the "tag" parameter' (#102) from crearimagengit-no-tag into main
ogclient/pipeline/tag This commit looks good Details
ogclient/pipeline/head This commit looks good Details
Reviewed-on: #102
2025-07-24 15:39:18 +02:00
Natalia Serrano 463381fcde refs #2521 have CrearImagenGit not receive the "tag" parameter 2025-07-24 15:38:47 +02:00
Natalia Serrano f2f9fb3380 Merge pull request 'refs #2532 have GetGitData deal with the fact that .git may be a regular file' (#101) from fix-getgitdata into main
ogclient/pipeline/tag This commit looks good Details
ogclient/pipeline/head This commit looks good Details
Reviewed-on: #101
2025-07-24 15:22:58 +02:00
Natalia Serrano 8a1f881ce3 refs #2532 have GetGitData deal with the fact that .git may be a regular file 2025-07-24 15:22:34 +02:00
Natalia Serrano 9bbcfa6907 Merge pull request 'listswinfo' (#100) from listswinfo into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #100
2025-07-24 15:18:55 +02:00
Natalia Serrano 04d5a0dba1 refs #2530 show listSoftwareInfo errors in the log 2025-07-24 15:18:37 +02:00
Natalia Serrano b402ae6973 refs #2530 show listSoftwareInfo errors in the log 2025-07-24 15:18:10 +02:00
Natalia Serrano e2500eb491 Merge pull request 'refs #2526 fix bugs' (#99) from fix-3-bugs into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #99
2025-07-23 15:04:32 +02:00
Natalia Serrano 67bdc29abd refs #2526 fix bugs 2025-07-23 15:03:01 +02:00
Natalia Serrano 408b93d000 Merge pull request 'refs #2422 rename scripts' (#98) from rename-sh-py into main
ogclient/pipeline/head This commit looks good Details
ogclient/pipeline/tag This commit looks good Details
Reviewed-on: #98
2025-07-18 12:14:45 +02:00
8 changed files with 47 additions and 20 deletions

View File

@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.0] - 2025-07-24
### Changed
- Have CrearImagenGit not receive the "tag" parameter
## [1.0.3] - 2025-07-24
### Fixed
- Have GetGitData deal with the fact that .git may be a regular file
## [1.0.2] - 2025-07-24
### Changed
- Write listSoftwareInfo errors in the log
## [1.0.1] - 2025-07-23
### Fixed
- Fixed small bugs in the py init scripts
## [1.0.0] - 2025-07-18
### Changed

View File

@ -4,8 +4,9 @@
import os
import sys
OPENGNSYS = os.environ.get ('OPENGNSYS', '/opt/opengnsys')
os.environ['PYTHONPATH'] = f'{OPENGNSYS}/lib/python3'
sys.path.insert (0, os.environ['PYTHONPATH'])
libs = [f'{OPENGNSYS}/lib/python3', '/usr/share/opengnsys-modules/python3/dist-packages']
os.environ['PYTHONPATH'] = ':'.join (libs)
for l in libs: sys.path.insert (0, l)
## end
import subprocess

View File

@ -4,7 +4,6 @@ import resource
import logging
import NetLib
import ogGlobals
import SystemLib
import DiskLib
@ -35,7 +34,7 @@ class OgLogger(logging.StreamHandler):
def create_image(disk_num, partition_num, repo, image_name, tagName):
def create_image(disk_num, partition_num, repo, image_name):
ntfs_impl = NTFSImplementation.NTFS3G
og_git = OpengnsysGitLibrary(ntfs_implementation = ntfs_impl)
@ -44,8 +43,6 @@ def create_image(disk_num, partition_num, repo, image_name, tagName):
device = DiskLib.ogDiskToDev(disk_num, partition_num)
if og_git.initRepo(device, image_name):
return 0
#if tagName:
# og_git.tag(device = device, tagName = tagName, commit = "HEAD", message = "Image created")
else:
return 1
@ -63,14 +60,13 @@ def main():
if len(sys.argv) != 6:
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, "Incorrect number of arguments. Usage: CrearImagenGit disk_num partition_num image_name repo tag"))
if len(sys.argv) < 5:
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, "Incorrect number of arguments. Usage: CrearImagenGit disk_num partition_num image_name repo"))
# repo - repositorio, ip address. Opcional porque oglive lo recibe como parametro de kernel
# tag - tag a crear automaticamente. Opcional, no necesitamos crear un tag siempre.
disk_num, partition_num, image_name, repo, tag = sys.argv[1:6]
disk_num, partition_num, image_name, repo = sys.argv[1:5]
opengnsys_log_dir = "/opt/opengnsys/log"
@ -96,7 +92,7 @@ def main():
logger.info("Starting CrearImagenGit")
retval = create_image(disk_num, partition_num, repo, image_name, tag)
retval = create_image(disk_num, partition_num, repo, image_name)

4
ogclient/interfaceAdm/GetGitData 100644 → 100755
View File

@ -23,8 +23,8 @@ ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_INTERFACE_START} {prog}
mntpt = ogMount (dsk, par)
git_dir = f'{mntpt}/.git'
if not os.path.isdir (git_dir):
ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'"{git_dir}" no existe o no es un directorio')
if not os.path.exists (git_dir):
ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'"{git_dir}" no existe')
sys.exit (1)
p = subprocess.run (['git', '--git-dir', git_dir, 'branch', '--show-current'], capture_output=True, text=True)

View File

@ -27,12 +27,18 @@ if __name__ == "__main__":
# Registro de inicio de ejecución
ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_INTERFACE_START} {prog} {disk} {par} {dest_file}')
listsi_out = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/listSoftwareInfo', disk, par], capture_output=True, text=True).stdout
p = subprocess.run ([f'{ogGlobals.OGSCRIPTS}/listSoftwareInfo', disk, par], capture_output=True, text=True)
listsi_out = p.stdout
listsi_err = p.stderr
if listsi_out:
file = listsi_out.splitlines()[0]
else:
ogRaiseError ([], ogGlobals.OG_ERR_GENERIC, 'listSoftwareInfo failed')
sys.exit (1)
if listsi_err:
ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, listsi_err)
sys.exit (1)
else:
ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, 'listSoftwareInfo failed')
sys.exit (1)
shutil.copy (file, dest_file)

View File

@ -10,7 +10,6 @@
#
import os
import sys
sys.path.insert(0, "/usr/share/opengnsys-modules/python3/dist-packages")
import shutil

View File

@ -95,7 +95,8 @@ def clean_esp():
if esp:
esp_disk, esp_par = esp.split()
mntpt = ogMount (esp_disk, esp_par)
os.unlink (f'{mntpt}/boot/grub/grub.cfg')
if os.path.exists (f'{mntpt}/boot/grub/grub.cfg'):
os.unlink (f'{mntpt}/boot/grub/grub.cfg')
ogUnmount (esp_disk, esp_par)
def fileslinks():
@ -227,7 +228,7 @@ def filebeat():
os.chmod (F, 0o600)
subprocess.run (['sed', '-i',
'-e', f's/__OGLOG_IP/{oglog}/g',
'-e', f's/__OGLOG_IP__/{oglog}/g',
'-e', f's/__OGLOG_PORT__/{OPENSEARCH_PORT}/g',
'-e', f's/__OPENSEARCH_PASSWORD__/{PASS}/g',
F

View File

@ -160,7 +160,7 @@ def ogGetIpAddress():
addrs = e['addr_info']
for a in addrs:
if 'inet' != a['family']: continue
addresses.append ({ 'local': a['local'], 'prefixlen': a['prefixlen'] })
addresses.append (a['local'])
if 1 != len (addresses):
raise Exception ('more than one local IP address found')