feat(xo-server,xo-web/proxy/deploy): ability to set HTTP proxy (#5145)
This commit is contained in:
parent
349a78a5bd
commit
c49d70170e
@ -20,6 +20,7 @@
|
||||
|
||||
- [Backup/Restore] Fixes `an error has occurred` when all backups for a specific VM have been deleted (PR [#5156](https://github.com/vatesfr/xen-orchestra/pull/5156))
|
||||
- [OVA Import] fix import of Red Hat generated .ova files (PR [#5159](https://github.com/vatesfr/xen-orchestra/pull/5159))
|
||||
- [Proxy/deploy] Ability to set HTTP proxy configuration (PR [#5145](https://github.com/vatesfr/xen-orchestra/pull/5145))
|
||||
|
||||
### Packages to release
|
||||
|
||||
|
@ -96,16 +96,20 @@ update.params = {
|
||||
},
|
||||
}
|
||||
|
||||
export function deploy({ license, network, networkConfiguration, proxy, sr }) {
|
||||
export function deploy({ license, network, proxy, sr, ...props }) {
|
||||
return this.deployProxy(sr._xapiId, license, {
|
||||
networkConfiguration,
|
||||
networkId: network?._xapiId,
|
||||
proxyId: proxy,
|
||||
...props,
|
||||
})
|
||||
}
|
||||
|
||||
deploy.permission = 'admin'
|
||||
deploy.params = {
|
||||
httpProxy: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
license: {
|
||||
type: 'string',
|
||||
},
|
||||
|
@ -168,7 +168,7 @@ export default class Proxy {
|
||||
$defer,
|
||||
srId,
|
||||
licenseId,
|
||||
{ networkId, networkConfiguration }
|
||||
{ httpProxy, networkId, networkConfiguration }
|
||||
) {
|
||||
const app = this._app
|
||||
const xoProxyConf = this._xoProxyConf
|
||||
@ -217,6 +217,9 @@ export default class Proxy {
|
||||
}),
|
||||
'vm-data/xoa-updater-channel': JSON.stringify(xoProxyConf.channel),
|
||||
}
|
||||
if (httpProxy !== undefined) {
|
||||
xenstoreData['vm-data/xoa-updater-proxy-url'] = JSON.stringify(httpProxy)
|
||||
}
|
||||
if (networkConfiguration !== undefined) {
|
||||
xenstoreData['vm-data/ip'] = networkConfiguration.ip
|
||||
xenstoreData['vm-data/gateway'] = networkConfiguration.gateway
|
||||
@ -242,7 +245,7 @@ export default class Proxy {
|
||||
async deployProxy(
|
||||
srId,
|
||||
licenseId,
|
||||
{ networkConfiguration, networkId, proxyId } = {}
|
||||
{ httpProxy, networkConfiguration, networkId, proxyId } = {}
|
||||
) {
|
||||
const app = this._app
|
||||
const xoProxyConf = this._xoProxyConf
|
||||
@ -272,8 +275,9 @@ export default class Proxy {
|
||||
vm,
|
||||
xenstoreData,
|
||||
} = await this._createProxyVm(srId, licenseId, {
|
||||
networkId,
|
||||
httpProxy,
|
||||
networkConfiguration,
|
||||
networkId,
|
||||
})
|
||||
|
||||
if (redeploy) {
|
||||
|
@ -2380,6 +2380,8 @@ const messages = {
|
||||
proxyNetworkNetmaskPlaceHolder: 'Default to: {netmask}',
|
||||
proxySrPredicateInfo:
|
||||
'The select only contains SRs connected to at least one HVM-capable host',
|
||||
httpProxy: 'HTTP proxy',
|
||||
httpProxyPlaceholder: 'protocol://username:password@address:port',
|
||||
|
||||
// ----- Utils -----
|
||||
secondsFormat: '{seconds, plural, one {# second} other {# seconds}}',
|
||||
|
@ -77,6 +77,7 @@ const Modal = decorate([
|
||||
computed: {
|
||||
idDnsInput: generateId,
|
||||
idGatewayInput: generateId,
|
||||
idHttpProxyInput: generateId,
|
||||
idIpInput: generateId,
|
||||
idNetmaskInput: generateId,
|
||||
idSelectNetwork: generateId,
|
||||
@ -130,6 +131,21 @@ const Modal = decorate([
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
<SingleLineRow className='mt-1'>
|
||||
<Col mediumSize={4}>
|
||||
<Label htmlFor={state.idHttpProxyInput}>{_('httpProxy')}</Label>
|
||||
</Col>
|
||||
<Col mediumSize={8}>
|
||||
<input
|
||||
className='form-control'
|
||||
id={state.idHttpProxyInput}
|
||||
placeholder={formatMessage(messages.httpProxyPlaceholder)}
|
||||
name='httpProxy'
|
||||
onChange={effects.onInputChange}
|
||||
value={value.httpProxy}
|
||||
/>
|
||||
</Col>
|
||||
</SingleLineRow>
|
||||
<SingleLineRow className='mt-1'>
|
||||
<Col mediumSize={4}>
|
||||
<Label htmlFor={state.idSelectNetworkMode}>
|
||||
@ -295,6 +311,7 @@ const deployProxy = async ({ proxy } = {}) => {
|
||||
defaultValue: {
|
||||
dns: '',
|
||||
gateway: '',
|
||||
httpProxy: '',
|
||||
ip: '',
|
||||
netmask: '',
|
||||
networkMode: 'dhcp',
|
||||
@ -305,21 +322,24 @@ const deployProxy = async ({ proxy } = {}) => {
|
||||
<Icon icon='proxy' /> {title}
|
||||
</span>
|
||||
),
|
||||
}).then(({ sr, network, networkMode, ip, netmask, gateway, dns }) =>
|
||||
deployProxyAppliance(license, sr, {
|
||||
network: network === null ? undefined : network,
|
||||
networkConfiguration:
|
||||
networkMode === 'static'
|
||||
? {
|
||||
dns: (dns = dns.trim()) === '' ? DEFAULT_DNS : dns,
|
||||
gateway,
|
||||
ip,
|
||||
netmask:
|
||||
(netmask = netmask.trim()) === '' ? DEFAULT_NETMASK : netmask,
|
||||
}
|
||||
: undefined,
|
||||
proxy,
|
||||
})
|
||||
}).then(
|
||||
({ httpProxy, sr, network, networkMode, ip, netmask, gateway, dns }) =>
|
||||
deployProxyAppliance(license, sr, {
|
||||
httpProxy:
|
||||
(httpProxy = httpProxy.trim()) !== '' ? httpProxy : undefined,
|
||||
network: network === null ? undefined : network,
|
||||
networkConfiguration:
|
||||
networkMode === 'static'
|
||||
? {
|
||||
dns: (dns = dns.trim()) === '' ? DEFAULT_DNS : dns,
|
||||
gateway,
|
||||
ip,
|
||||
netmask:
|
||||
(netmask = netmask.trim()) === '' ? DEFAULT_NETMASK : netmask,
|
||||
}
|
||||
: undefined,
|
||||
proxy,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user