#708 #810: Actualizar documentación de API REST y añadir parámetro {{{locked}}} al modelo de datos de imagen del repositorio.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5478 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
ramon 2017-10-23 12:34:52 +00:00
parent 8196942cd6
commit 3b8d1ea75c
2 changed files with 38 additions and 3 deletions

View File

@ -993,6 +993,30 @@ paths:
tags:
- repository
- image
/repository/image/{ouname}/{imagename:
get:
description:
parameters:
- in: path
name: ouname
description: OU name (optional)
required: false
type: string
- in: path
name: imagename
description: image name
required: true
type: string
responses:
"200":
description: Successful response
schema:
$ref: "#/definitions/ImageModel"
security:
- apikey: []
tags:
- repository
- image
#/repository/poweron
/ogagent/started:
post:
@ -1234,5 +1258,9 @@ definitions:
description: image backup size (bytes)
type: integer
format: int64
required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode, backedup ]
locked:
description: image locked flag (check if `.lock` file exists)
type: boolean
default: false
required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode, backedup, locked ]

View File

@ -90,13 +90,15 @@ $app->get('/repository/images(/)', 'validateRepositoryApiKey',
$response['images'][$i]['size'] = @stat($file)['size'];
$response['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']);
$response['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4);
$backupfile = $file.".ant";
$backupfile = "$file.ant";
if (file_exists($backupfile)) {
$response['images'][$i]['backedup'] = true;
$response['images'][$i]['backupsize'] = @stat($backupfile)['size'];
} else {
$response['images'][$i]['backedup'] = false;
}
$lockfile = "$file.lock";
$response['images'][$i]['locked'] = file_exists($lockfile);
}
// Complete image in OUs information.
for ($j=0; $j<sizeof(@$response['ous']); $j++) {
@ -106,6 +108,9 @@ $app->get('/repository/images(/)', 'validateRepositoryApiKey',
$response['ous'][$j]['images'][$i]['size'] = @stat($file)['size'];
$response['ous'][$j]['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']);
$response['ous'][$j]['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4);
$response['ous'][$j]['images'][$i]['backedup'] = false;
$lockfile = "$file.lock";
$response['ous'][$j]['images'][$i]['locked'] = file_exists($lockfile);
}
}
// Retrieve disk information.
@ -158,13 +163,15 @@ $app->get('/repository/image(/:ouname)/:imagename(/)', 'validateRepositoryApiKey
$response['size'] = @stat($file)['size'];
$response['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']);
$response['mode'] = substr(decoct(@stat($file)['mode']), -4);
$backupfile = $file.".ant";
$backupfile = "$file.ant";
if (file_exists($backupfile)) {
$response['backedup'] = true;
$response['backupsize'] = @stat($backupfile)['size'];
} else {
$response['backedup'] = false;
}
$lockfile = "$file.lock";
$response['locked'] = file_exists($lockfile);
}
}
if (isset ($response)) {