Compare commits

...

11 Commits

Author SHA1 Message Date
Natalia Serrano 7624964ba1 Merge pull request 'refs #1925 send /stopped on poweroff or restart' (#33) from agent-stopped-on-poweroff into main
Reviewed-on: opengnsys/ogclone-engine#33
2025-04-23 13:59:20 +02:00
Natalia Serrano c3e86b7dc0 refs #1925 send /stopped on poweroff or restart 2025-04-23 13:58:51 +02:00
Natalia Serrano a18e861bea Merge pull request 'refs #1912 fix a couple of rc' (#32) from test-configurar-py into main
Reviewed-on: opengnsys/ogclone-engine#32
2025-04-21 12:49:14 +02:00
Natalia Serrano 842dbf48c2 refs #1912 fix a couple of rc 2025-04-21 12:48:47 +02:00
Natalia Serrano d79c677f16 Merge pull request 'refs #1918 fix getConfiguration.py' (#31) from fix-getConfiguration into main
Reviewed-on: opengnsys/ogclone-engine#31
2025-04-15 17:56:50 +02:00
Natalia Serrano bd056438a1 refs #1918 fix getConfiguration.py 2025-04-15 17:56:27 +02:00
Natalia Serrano fb665fa4ca Merge pull request 'refs #1908 remove refs to OGLOG' (#30) from remove-OGLOG into main
Reviewed-on: opengnsys/ogclone-engine#30
2025-04-15 17:17:18 +02:00
Natalia Serrano c76fd8388a refs #1908 remove refs to OGLOG 2025-04-15 17:16:48 +02:00
Natalia Serrano fac6e142f6 Merge pull request 'refs #1914 fix a couple of bugs' (#29) from fix-restaurar-imagen into main
Reviewed-on: opengnsys/ogclone-engine#29
2025-04-15 17:07:07 +02:00
Natalia Serrano e20bd46edb refs #1914 fix a couple of bugs 2025-04-15 17:06:34 +02:00
Natalia Serrano f785143b73 Merge pull request 'refs #1916 move ogGetIpAddress to NetLib' (#28) from move-ogGetIpAddress into main
Reviewed-on: opengnsys/ogclone-engine#28
2025-04-15 17:04:00 +02:00
10 changed files with 50 additions and 8 deletions

View File

@ -5,6 +5,36 @@ 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).
## [0.8.0] - 2025-04-23
### Added
- Have the oglive agent send /stopped on poweroff or restart
## [0.7.2] - 2025-04-21
### Fixed
- Have the partitioning functions return a meaningful rc
## [0.7.1] - 2025-04-15
### Fixed
- getConfiguration.py: don't fail if NTFS filesystems are mounted ro
## [0.7.0] - 2025-04-15
### Removed
- Removed references to ogGlobals.OGLOG in python code
## [0.6.1] - 2025-04-15
### Fixed
- Fixed capturing of partclone output and management of return value
## [0.6.0] - 2025-04-15
### Changed

View File

@ -2,6 +2,9 @@
import os
import sys
import time
os.system ('pkill -f OGAgent')
time.sleep (3)
os.system ('poweroff')
sys.exit (0)

View File

@ -2,6 +2,9 @@
import os
import sys
import time
os.system ('pkill -f OGAgent')
time.sleep (3)
os.system ('reboot')
sys.exit (0)

View File

@ -74,4 +74,5 @@ else:
# Borramos marcas de arranque de Windows
for f in glob.glob ('/mnt/*/ogboot.*') + glob.glob ('/mnt/*/*/ogboot.*'):
os.unlink (f)
try: os.unlink (f)
except: pass

View File

@ -179,7 +179,7 @@ def ogCreatePartitions (disk, parts):
p = subprocess.run (['sfdisk', DISK], input=sfdisk_input, capture_output=True, text=True)
subprocess.run (['partprobe', DISK])
if CACHESIZE: CacheLib.ogMountCache()
return True
return not p.returncode
#/**
@ -285,7 +285,7 @@ def ogCreateGptPartitions (disk, parts):
p = subprocess.run (['sgdisk'] + DELOPTIONS + OPTIONS + [DISK], capture_output=True, text=True)
subprocess.run (['partprobe', DISK])
if CACHESIZE: CacheLib.ogMountCache()
return True
return not p.returncode
#/**

View File

@ -512,6 +512,8 @@ def ogRestoreImage (repo, imgpath, disk, par):
rc = None
try:
p = subprocess.run (program, shell=True, capture_output=True, text=True)
print (p.stdout)
print (p.stderr)
rc = p.returncode
if not rc:
SystemLib.ogRaiseError ([], ogGlobalsOG_ERR_IMAGE, f'{imgfile}, {disk}, {par}')

View File

@ -61,9 +61,8 @@ OGPYFUNCS = os.path.join (OPENGNSYS, 'functions')
OGSCRIPTS = os.path.join (OPENGNSYS, 'scripts')
OGIMG = os.path.join (OPENGNSYS, 'images')
OGCAC = os.path.join (OPENGNSYS, 'cache')
OGLOG = '/var/log'
OGLOGFILE = f'{OGLOG}/clone-engine.log'
OGJSONLOGFILE = f'{OGLOG}/clone-engine.json.log'
OGLOGFILE = '/var/log/clone-engine.log'
OGJSONLOGFILE = '/var/log/clone-engine.json.log'
DEBUG = 'yes'
_path = os.environ['PATH'] + ':/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/oglive/rootfs/opt/drbl/sbin'
os.environ['PATH'] = ':'.join ([OGSCRIPTS, _path, OGAPI, OGBIN])

View File

@ -145,6 +145,10 @@ def main (repo, imgname, disk, par, proto='UNICAST', protoopt=''):
SystemLib.ogEcho (['log', 'session'], None, f'[55] {ogGlobals.lang.MSG_HELP_ogRestoreImage}: restoreImage {params}')
retval = subprocess.run (['restoreImage.py'] + params).returncode
## turn shell's success into python success (without ending up with True or False)
if retval: retval = 0
else: retval = 1
# Mostrar resultados.
resumerestoreimage = subprocess.run (['grep', '--max-count', '1', 'Total Time:', ogGlobals.OGLOGCOMMAND], capture_output=True, text=True).stdout
SystemLib.ogEcho (['log', 'session'], None, f' [ ] {resumerestoreimage} ')

View File

@ -21,7 +21,7 @@ if len (sys.argv) > 1:
#SERVERLOGDIR = unused
# Fichero de listado: hard-IP
HARDFILE = f'{ogGlobals.OGLOG}/hard-{ogGetIpAddress()}'
HARDFILE = f'/tmp/hard-{ogGetIpAddress()}'
out = ogListHardwareInfo()
with open (HARDFILE, 'w') as fd:
fd.write (out)

View File

@ -18,7 +18,7 @@ prog = os.path.basename (sys.argv[0])
def main (disk, par, reduced):
ip = NetLib.ogGetIpAddress()
softfile = f'{ogGlobals.OGLOG}/soft-{ip}-{disk}-{par}'
softfile = f'/tmp/soft-{ip}-{disk}-{par}'
software_list = InventoryLib.ogListSoftware (disk, par)
if reduced: