Compare commits
2 Commits
should-pro
...
pierre-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1efe1d82cf | ||
|
|
c4b4ee6476 |
@@ -17,6 +17,7 @@
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [SR] Fix `[object HTMLInputElement]` name after re-attaching a SR [#4546](https://github.com/vatesfr/xen-orchestra/issues/4546) (PR [#4550](https://github.com/vatesfr/xen-orchestra/pull/4550))
|
||||
- [Patches] Better error handling when fetching missing patches (PR [#4519](https://github.com/vatesfr/xen-orchestra/pull/4519))
|
||||
|
||||
### Released packages
|
||||
|
||||
|
||||
@@ -172,3 +172,11 @@ export const patchPrecheckFailed = create(20, ({ errorType, patch }) => ({
|
||||
},
|
||||
message: `patch precheck failed: ${errorType}`,
|
||||
}))
|
||||
|
||||
export const listMissingPatchesFailed = create(21, ({ host, reason }) => ({
|
||||
data: {
|
||||
host,
|
||||
reason,
|
||||
},
|
||||
message: 'could not fetch missing patches',
|
||||
}))
|
||||
|
||||
@@ -2,6 +2,7 @@ import createLogger from '@xen-orchestra/log'
|
||||
import deferrable from 'golike-defer'
|
||||
import unzip from 'julien-f-unzip'
|
||||
import { filter, find, pickBy, some } from 'lodash'
|
||||
import { listMissingPatchesFailed } from 'xo-common/api-errors'
|
||||
|
||||
import ensureArray from '../../_ensureArray'
|
||||
import { debounce } from '../../decorators'
|
||||
@@ -40,7 +41,7 @@ const XCP_NG_DEBOUNCE_TIME_MS = 60000
|
||||
// list all yum updates available for a XCP-ng host
|
||||
// (hostObject) → { uuid: patchObject }
|
||||
async function _listXcpUpdates(host) {
|
||||
return JSON.parse(
|
||||
const patches = JSON.parse(
|
||||
await this.call(
|
||||
'host.call_plugin',
|
||||
host.$ref,
|
||||
@@ -49,6 +50,15 @@ async function _listXcpUpdates(host) {
|
||||
{}
|
||||
)
|
||||
)
|
||||
|
||||
if (patches.error !== undefined) {
|
||||
throw listMissingPatchesFailed({
|
||||
host: host.$id,
|
||||
reason: patches.error,
|
||||
})
|
||||
}
|
||||
|
||||
return patches
|
||||
}
|
||||
|
||||
const _listXcpUpdateDebounced = debounceWithKey(
|
||||
|
||||
@@ -913,8 +913,8 @@ const messages = {
|
||||
installAllPatchesOnHostContent:
|
||||
'Are you sure you want to install all patches on this host?',
|
||||
patchRelease: 'Release',
|
||||
updatePluginNotInstalled:
|
||||
'An error occurred while fetching the patches. Please make sure the updater plugin is installed by running `yum install xcp-ng-updater` on the host.',
|
||||
cannotFetchMissingPatches:
|
||||
'We are unable to fetch the missing patches at the moment…',
|
||||
showChangelog: 'Show changelog',
|
||||
changelog: 'Changelog',
|
||||
changelogPatch: 'Patch',
|
||||
|
||||
@@ -761,15 +761,16 @@ export const disableHost = host =>
|
||||
|
||||
export const getHostMissingPatches = async host => {
|
||||
const hostId = resolveId(host)
|
||||
if (host.productBrand !== 'XCP-ng') {
|
||||
try {
|
||||
const patches = await _call('pool.listMissingPatches', { host: hostId })
|
||||
// Hide paid patches to XS-free users
|
||||
return host.license_params.sku_type !== 'free'
|
||||
? patches
|
||||
: filter(patches, { paid: false })
|
||||
}
|
||||
try {
|
||||
return await _call('pool.listMissingPatches', { host: hostId })
|
||||
if (
|
||||
host.productBrand !== 'XCP-ng' &&
|
||||
host.license_params.sku_type !== 'free'
|
||||
) {
|
||||
return filter(patches, { paid: false })
|
||||
}
|
||||
return patches
|
||||
} catch (_) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import styles from './index.css'
|
||||
getPoolHosts,
|
||||
hosts => {
|
||||
return Promise.all(map(hosts, host => getHostMissingPatches(host))).then(
|
||||
patches => uniq(map(flatten(patches), 'name'))
|
||||
patches => uniq(map(flatten(patches.filter(Boolean)), 'name'))
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -285,7 +285,7 @@ export default class TabPatches extends Component {
|
||||
)
|
||||
}
|
||||
if (this.props.missingPatches === null) {
|
||||
return <em>{_('updatePluginNotInstalled')}</em>
|
||||
return <em>{_('cannotFetchMissingPatches')}</em>
|
||||
}
|
||||
const Patches =
|
||||
this.props.host.productBrand === 'XCP-ng' ? XcpPatches : XenServerPatches
|
||||
|
||||
@@ -198,7 +198,15 @@ export default class TabPatches extends Component {
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
{productBrand === 'XCP-ng' ? (
|
||||
{missingPatches === null ? (
|
||||
<Row>
|
||||
<Col>
|
||||
<p>
|
||||
<em>{_('cannotFetchMissingPatches')}</em>
|
||||
</p>
|
||||
</Col>
|
||||
</Row>
|
||||
) : productBrand === 'XCP-ng' ? (
|
||||
<Row>
|
||||
<Col>
|
||||
<h3>{_('hostMissingPatches')}</h3>
|
||||
|
||||
Reference in New Issue
Block a user