mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-29 18:50:08 +03:00
M #-: Bump ansible version + update vm config tab (#2817)
This commit is contained in:
parent
7e1f78ace9
commit
367230aabf
@ -25,11 +25,9 @@ import ButtonToTriggerForm from 'client/components/Forms/ButtonToTriggerForm'
|
||||
import { UpdateConfigurationForm } from 'client/components/Forms/Vm'
|
||||
import { List } from 'client/components/Tabs/Common'
|
||||
|
||||
import { getHypervisor, isAvailableAction } from 'client/models/VirtualMachine'
|
||||
import { getActionsAvailable, jsonToXml } from 'client/models/Helper'
|
||||
import { T, VM_ACTIONS, ATTR_CONF_CAN_BE_UPDATED } from 'client/constants'
|
||||
|
||||
const { UPDATE_CONF } = VM_ACTIONS
|
||||
import { getHypervisor } from 'client/models/VirtualMachine'
|
||||
import { jsonToXml } from 'client/models/Helper'
|
||||
import { T, ATTR_CONF_CAN_BE_UPDATED } from 'client/constants'
|
||||
|
||||
/**
|
||||
* Renders configuration tab.
|
||||
@ -47,15 +45,6 @@ const VmConfigurationTab = ({ tabProps: { actions } = {}, id }) => {
|
||||
|
||||
const hypervisor = useMemo(() => getHypervisor(vm), [vm])
|
||||
|
||||
const isUpdateConfEnabled = useMemo(() => {
|
||||
const actionsByHypervisor = getActionsAvailable(actions, hypervisor)
|
||||
const actionsByState = actionsByHypervisor.filter((action) =>
|
||||
isAvailableAction(action, vm)
|
||||
)
|
||||
|
||||
return actionsByState.includes?.(UPDATE_CONF)
|
||||
}, [vm])
|
||||
|
||||
const sections = useMemo(() => {
|
||||
const filterSection = (section) => {
|
||||
const supported = ATTR_CONF_CAN_BE_UPDATED[section] || '*'
|
||||
@ -110,31 +99,29 @@ const VmConfigurationTab = ({ tabProps: { actions } = {}, id }) => {
|
||||
|
||||
return (
|
||||
<Box padding={{ sm: '0.8em' }}>
|
||||
{isUpdateConfEnabled && (
|
||||
<ButtonToTriggerForm
|
||||
buttonProps={{
|
||||
color: 'secondary',
|
||||
'data-cy': 'update-conf',
|
||||
label: T.UpdateVmConfiguration,
|
||||
variant: 'outlined',
|
||||
disabled: isFetching,
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
dialogProps: {
|
||||
title: T.UpdateVmConfiguration,
|
||||
dataCy: 'modal-update-conf',
|
||||
},
|
||||
form: () =>
|
||||
UpdateConfigurationForm({
|
||||
stepProps: { hypervisor },
|
||||
initialValues: vm,
|
||||
}),
|
||||
onSubmit: handleUpdateConf,
|
||||
<ButtonToTriggerForm
|
||||
buttonProps={{
|
||||
color: 'secondary',
|
||||
'data-cy': 'update-conf',
|
||||
label: T.UpdateVmConfiguration,
|
||||
variant: 'outlined',
|
||||
disabled: isFetching,
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
dialogProps: {
|
||||
title: T.UpdateVmConfiguration,
|
||||
dataCy: 'modal-update-conf',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
form: () =>
|
||||
UpdateConfigurationForm({
|
||||
stepProps: { hypervisor },
|
||||
initialValues: vm,
|
||||
}),
|
||||
onSubmit: handleUpdateConf,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Stack
|
||||
display="grid"
|
||||
|
@ -41,7 +41,7 @@ CONFIG_DEFAULTS = {
|
||||
}
|
||||
|
||||
# Ansible params
|
||||
ANSIBLE_VERSION = [Gem::Version.new('2.8'), Gem::Version.new('2.10')]
|
||||
ANSIBLE_VERSION = [Gem::Version.new('2.12'), Gem::Version.new('2.13')]
|
||||
ANSIBLE_ARGS = "--ssh-common-args='-o UserKnownHostsFile=/dev/null'"
|
||||
ANSIBLE_INVENTORY_DEFAULT = 'default'
|
||||
CEPH_ANSIBLE_URL = 'https://github.com/ceph/ceph-ansible.git'
|
||||
@ -76,10 +76,9 @@ module OneProvision
|
||||
version = version.match(/\d+[.]\d+[.]\d+/)
|
||||
version = Gem::Version.new(version)
|
||||
|
||||
if (version < ANSIBLE_VERSION[0]) ||
|
||||
(version >= ANSIBLE_VERSION[1])
|
||||
Utils.fail("Unsupported Ansible ver. #{version}, " \
|
||||
"must be >= #{ansible_min} and < #{ansible_max}")
|
||||
if (version < ANSIBLE_VERSION[0]) || (version >= ANSIBLE_VERSION[1])
|
||||
Utils.fail("Unsupported Ansible version #{version}, " \
|
||||
"must be >= #{ANSIBLE_VERSION[0]} and < #{ANSIBLE_VERSION[1]}")
|
||||
end
|
||||
|
||||
return if provision.nil? || !provision.hci?
|
||||
|
Loading…
x
Reference in New Issue
Block a user