|
|
@@ -46,7 +46,6 @@ export const defaultFillMigrationImageMapValues = (
|
|
|
field: Field,
|
|
|
option: OptionValues,
|
|
|
migrationImageMapFieldName: string,
|
|
|
- imageSuffix: string,
|
|
|
): boolean => {
|
|
|
if (field.name !== migrationImageMapFieldName) {
|
|
|
return false
|
|
|
@@ -68,7 +67,7 @@ export const defaultFillMigrationImageMapValues = (
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- name: `${os}${imageSuffix}`,
|
|
|
+ name: os,
|
|
|
type: 'string',
|
|
|
enum: values,
|
|
|
}
|
|
|
@@ -79,13 +78,12 @@ export const defaultFillMigrationImageMapValues = (
|
|
|
export const defaultGetDestinationEnv = (
|
|
|
options?: { [prop: string]: any } | null,
|
|
|
oldOptions?: { [prop: string]: any } | null,
|
|
|
- imageSuffix?: string,
|
|
|
): any => {
|
|
|
const env: any = {}
|
|
|
const specialOptions = ['execute_now', 'separate_vm', 'skip_os_morphing', 'description']
|
|
|
.concat(migrationFields.map(f => f.name))
|
|
|
.concat(executionOptions.map(o => o.name))
|
|
|
- .concat(migrationImageOsTypes.map(o => `${o}${imageSuffix}`))
|
|
|
+ .concat(migrationImageOsTypes)
|
|
|
|
|
|
if (!options) {
|
|
|
return env
|
|
|
@@ -119,7 +117,6 @@ export const defaultGetMigrationImageMap = (
|
|
|
options: { [prop: string]: any } | null | undefined,
|
|
|
oldOptions: any,
|
|
|
migrationImageMapFieldName: string,
|
|
|
- imageSuffix: string,
|
|
|
) => {
|
|
|
const env: any = {}
|
|
|
const usableOptions = options
|
|
|
@@ -132,13 +129,13 @@ export const defaultGetMigrationImageMap = (
|
|
|
return env
|
|
|
}
|
|
|
migrationImageOsTypes.forEach(os => {
|
|
|
- let value = usableOptions[migrationImageMapFieldName][`${os}${imageSuffix}`]
|
|
|
+ let value = usableOptions[migrationImageMapFieldName][os]
|
|
|
|
|
|
// Make sure the migr. image mapping has all the OSes filled,
|
|
|
// even if only one OS mapping was updated,
|
|
|
// ie. don't send just the updated OS map to the server, send them all if one was updated.
|
|
|
if (!value) {
|
|
|
- value = oldOptions?.[migrationImageMapFieldName]?.[`${os}${imageSuffix}`]
|
|
|
+ value = oldOptions?.[migrationImageMapFieldName]?.[os]
|
|
|
if (!value) {
|
|
|
return
|
|
|
}
|
|
|
@@ -148,7 +145,7 @@ export const defaultGetMigrationImageMap = (
|
|
|
env[migrationImageMapFieldName] = {}
|
|
|
}
|
|
|
|
|
|
- env[migrationImageMapFieldName][`${os}${imageSuffix}`] = value
|
|
|
+ env[migrationImageMapFieldName][os] = value
|
|
|
})
|
|
|
|
|
|
return env
|
|
|
@@ -157,8 +154,6 @@ export const defaultGetMigrationImageMap = (
|
|
|
export default class OptionsSchemaParser {
|
|
|
static migrationImageMapFieldName = 'migr_image_map'
|
|
|
|
|
|
- static imageSuffix = '_os_image'
|
|
|
-
|
|
|
static parseSchemaToFields(
|
|
|
schema: SchemaProperties, schemaDefinitions?: SchemaDefinitions | null, dictionaryKey?: string,
|
|
|
) {
|
|
|
@@ -175,7 +170,6 @@ export default class OptionsSchemaParser {
|
|
|
field,
|
|
|
option,
|
|
|
this.migrationImageMapFieldName,
|
|
|
- this.imageSuffix,
|
|
|
)) {
|
|
|
defaultFillFieldValues(field, option)
|
|
|
}
|
|
|
@@ -186,13 +180,11 @@ export default class OptionsSchemaParser {
|
|
|
...defaultGetDestinationEnv(
|
|
|
options,
|
|
|
oldOptions,
|
|
|
- this.imageSuffix,
|
|
|
),
|
|
|
...defaultGetMigrationImageMap(
|
|
|
options,
|
|
|
oldOptions,
|
|
|
this.migrationImageMapFieldName,
|
|
|
- this.imageSuffix,
|
|
|
),
|
|
|
}
|
|
|
return env
|