refs #242504 add script for getting data out of deployed git images
parent
4716c9a8b1
commit
ca5df3e854
|
|
@ -5,6 +5,12 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.30.0] - 2025-07-17
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add script for getting data out of deployed git images
|
||||||
|
|
||||||
## [0.29.0] - 2025-07-17
|
## [0.29.0] - 2025-07-17
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import ogGlobals
|
||||||
|
from SystemLib import ogEcho, ogRaiseError
|
||||||
|
from FileSystemLib import ogMount
|
||||||
|
|
||||||
|
prog = sys.argv[0]
|
||||||
|
if len (sys.argv) != 4:
|
||||||
|
print (f'Usage: {prog} <dsk> <par> <tmpfile>')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
dsk = sys.argv[1]
|
||||||
|
par = sys.argv[2]
|
||||||
|
tmpfile = sys.argv[3]
|
||||||
|
|
||||||
|
# Registro de inicio de ejecución
|
||||||
|
ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_INTERFACE_START} {prog} {dsk} {par} {tmpfile}')
|
||||||
|
|
||||||
|
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')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
p = subprocess.run (['git', '--git-dir', git_dir, 'branch', '--show-current'], capture_output=True, text=True)
|
||||||
|
rc = p.returncode
|
||||||
|
if 0 != rc:
|
||||||
|
ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_GENERIC, '')
|
||||||
|
ogEcho (['log', 'session'], 'error', p.stderr)
|
||||||
|
sys.exit (1)
|
||||||
|
branch = p.stdout.strip()
|
||||||
|
|
||||||
|
p = subprocess.run (['git', '--git-dir', git_dir, 'remote', 'get-url', 'origin'], capture_output=True, text=True)
|
||||||
|
rc = p.returncode
|
||||||
|
if 0 != rc:
|
||||||
|
ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_GENERIC, '')
|
||||||
|
ogEcho (['log', 'session'], 'error', p.stderr)
|
||||||
|
sys.exit (1)
|
||||||
|
repo = os.path.basename (p.stdout.strip())
|
||||||
|
repo = repo.replace ('.git', '')
|
||||||
|
|
||||||
|
with open (tmpfile, 'w') as fd:
|
||||||
|
fd.write (f'{branch}:{repo}\n')
|
||||||
|
|
||||||
|
# Registro de fin de ejecución
|
||||||
|
ogEcho (['log', 'session'], None, f'{ogGlobals.lang.MSG_INTERFACE_END} 0')
|
||||||
|
|
||||||
|
sys.exit (0)
|
||||||
Loading…
Reference in New Issue