1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #5819: fix import marketapp (#2133)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-06-07 18:27:53 +02:00 committed by GitHub
parent 1b70b07c2b
commit e264f61a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View File

@ -58,7 +58,7 @@ export const onedConfIncludesAction = (
onedConf = {},
action = 'monitor'
) => {
const isInZone = onedConf.FEDERATION?.ZONE_ID === marketplace.ZONE_ID
const isInZone = (onedConf.FEDERATION?.ZONE_ID ?? '0') === marketplace.ZONE_ID
const includesAction = onedConf.MARKET_MAD_CONF?.some(
({ APP_ACTIONS, NAME }) =>
APP_ACTIONS?.includes(action) &&

View File

@ -206,7 +206,7 @@ const importMarket = (res = {}, next = defaultEmptyFunction, params = {}) => {
let rtn = httpBadRequest
const { resource, id, marketId, associated, vmname } = params
if (id && ['vm', 'vm-template'].includes(params.resource)) {
if (id && ['vm', 'vm-template'].includes(resource)) {
let message = ''
const paramsCommand = [resource, 'import', `${id}`]

View File

@ -25,7 +25,7 @@ const {
const {
MARKETAPP_EXPORT,
MARKETAPP_DOWNLOAD,
MARKETAPP_VMIMPORT,
MARKETAPP_IMPORT,
MARKETAPP_DOCKERTAGS,
} = Actions
@ -39,7 +39,7 @@ module.exports = [
action: downloadApp,
},
{
...Commands[MARKETAPP_VMIMPORT],
...Commands[MARKETAPP_IMPORT],
action: importMarket,
},
{

View File

@ -25,13 +25,13 @@ const { query, resource, postBody } = fromData
const basepath = '/marketapp'
const MARKETAPP_EXPORT = 'marketapp.export'
const MARKETAPP_DOWNLOAD = 'marketapp.download'
const MARKETAPP_VMIMPORT = 'marketapp.vmimport'
const MARKETAPP_IMPORT = 'marketapp.import'
const MARKETAPP_DOCKERTAGS = 'marketapp.dockertags'
const Actions = {
MARKETAPP_EXPORT,
MARKETAPP_DOWNLOAD,
MARKETAPP_VMIMPORT,
MARKETAPP_IMPORT,
MARKETAPP_DOCKERTAGS,
}
@ -82,8 +82,8 @@ module.exports = {
},
},
},
[MARKETAPP_VMIMPORT]: {
path: `${basepath}/vmimport/:vmId`,
[MARKETAPP_IMPORT]: {
path: `${basepath}/vmimport/:id`,
httpMethod: POST,
auth: true,
params: {
@ -91,7 +91,7 @@ module.exports = {
from: resource,
},
resource: {
from: resource,
from: postBody,
},
associated: {
from: postBody,

View File

@ -35,6 +35,7 @@ const ALLOWED_KEYS_ONED_CONF = [
'VN_MAD_CONF',
'IM_MAD',
'AUTH_MAD',
'FEDERATION',
]
/**