refs #2504 add endpoint for GetGitData

add-getgitdata
Natalia Serrano 2025-07-18 14:08:53 +02:00
parent 950b163602
commit 41a9f7ce21
2 changed files with 41 additions and 0 deletions

View File

@ -6,6 +6,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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [6.2.0] - 2025-07-18
### Added
- Add endpoint for GetGitData
## [6.1.1] - 2025-06-26
### Changed

View File

@ -1032,3 +1032,38 @@ class ogAdmClientWorker (ogLiveWorker):
r.update ({ 'nfn':'RESPUESTA_KillJob', 'job':jid })
logger.debug (f'r aft ({r})')
return r
@execution_level('full')
@check_secret
def process_GetGitData (self, path, get_params, post_params, server):
logger.debug ('in process_GetGitData, path "{}" get_params "{}" post_params "{}" server "{}"'.format (path, get_params, post_params, server))
for k in ['nfn', 'dsk', 'par', 'nfn']:
if k not in post_params:
logger.error (f'required parameter ({k}) not in POST params')
return {}
tmp_gitdata = f'/tmp/gitdata-{self.IPlocal}'
nfn = post_params['nfn']
dsk = post_params['dsk']
par = post_params['par']
try:
self.interfaceAdmin (nfn, [dsk, par, tmp_gitdata])
herror = 0
except:
herror = 1
if not os.path.exists (tmp_gitdata):
return self.respuestaEjecucionComando ({'nfn':'RESPUESTA_GetGitData'}, 1)
with open (tmp_gitdata, 'r') as fd:
gitdata = fd.read().strip()
branch, repo = gitdata.split (':')
cmd = {
'nfn': 'RESPUESTA_GetGitData',
'branch': branch,
'repo': repo,
}
return self.respuestaEjecucionComando (cmd, herror)