Skip to content

Commit

Permalink
Merge branch 'main' into ao/136301-update-view-filter-title
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jul 20, 2022
2 parents e66706d + 030ff82 commit 404a153
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion x-pack/plugins/fleet/server/services/agents/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server';
import moment from 'moment';
import pMap from 'p-map';
import uuid from 'uuid/v4';

import type { Agent, BulkActionResult, FleetServerAgentAction, CurrentUpgrade } from '../../types';
import {
Expand Down Expand Up @@ -100,6 +101,7 @@ export async function sendUpgradeAgentsActions(
}
}
} else if ('kuery' in options) {
const actionId = uuid();
return await processAgentsInBatches(
esClient,
{
Expand All @@ -108,7 +110,14 @@ export async function sendUpgradeAgentsActions(
batchSize: options.batchSize,
},
async (agents: Agent[], skipSuccess: boolean) =>
await upgradeBatch(soClient, esClient, agents, outgoingErrors, options, skipSuccess)
await upgradeBatch(
soClient,
esClient,
agents,
outgoingErrors,
{ ...options, actionId },
skipSuccess
)
);
}

Expand All @@ -121,6 +130,7 @@ async function upgradeBatch(
givenAgents: Agent[],
outgoingErrors: Record<Agent['id'], Error>,
options: ({ agents: Agent[] } | GetAgentsOptions) & {
actionId?: string;
version: string;
sourceUri?: string | undefined;
force?: boolean;
Expand Down Expand Up @@ -183,6 +193,7 @@ async function upgradeBatch(
);

await createAgentAction(esClient, {
id: options.actionId,
created_at: now,
data,
ack_data: data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const StepReview: React.FunctionComponent<Props> = React.memo(
} = serializedComponentTemplate;

const isFleetDatastreamsVisible =
dataStreams?.length && componentTemplate._meta?.managed_by === MANAGED_BY_FLEET;
Boolean(dataStreams?.length) && componentTemplate._meta?.managed_by === MANAGED_BY_FLEET;

const SummaryTab = () => (
<div data-test-subj="summaryTab">
Expand Down Expand Up @@ -125,7 +125,7 @@ export const StepReview: React.FunctionComponent<Props> = React.memo(
</EuiDescriptionListDescription>
</EuiDescriptionList>
</EuiFlexItem>
{isFleetDatastreamsVisible && (
{isFleetDatastreamsVisible && dataStreams && (
<EuiFlexItem>
{/* Datastream mappings */}
<FormattedMessage
Expand Down

0 comments on commit 404a153

Please sign in to comment.