Skip to content

Commit fad7b6c

Browse files
Eamonn SmithEamonn Smith
authored andcommitted
Merge branch '7.x' of github.com:elastic/beats into backport/7.x/pr-23580
Merge upstream
2 parents 3eb665b + fe6d96c commit fad7b6c

5 files changed

Lines changed: 30 additions & 15 deletions

File tree

x-pack/elastic-agent/CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- Fix incorrect hash when upgrading agent {pull}22322[22322]
3131
- Fix refresh of monitoring configuration {pull}23619[23619]
3232
- Fixed nil pointer during unenroll {pull}23609[23609]
33+
- Fixed reenroll scenario {pull}23686[23686]
3334

3435
==== New features
3536

x-pack/elastic-agent/pkg/agent/application/enroll_cmd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ func (c *EnrollCmd) Execute() error {
209209
return err
210210
}
211211

212+
// clear action store
213+
// fail only if file exists and there was a failure
214+
if err := os.Remove(info.AgentStateStoreFile()); !os.IsNotExist(err) {
215+
return err
216+
}
217+
212218
return nil
213219
}
214220

x-pack/elastic-agent/pkg/agent/application/upgrade/upgrade.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,25 @@ func rollbackInstall(ctx context.Context, hash string) {
247247
}
248248

249249
func copyActionStore(newHash string) error {
250-
currentActionStorePath := info.AgentActionStoreFile()
250+
storePaths := []string{info.AgentActionStoreFile(), info.AgentStateStoreFile()}
251251

252-
newHome := filepath.Join(filepath.Dir(paths.Home()), fmt.Sprintf("%s-%s", agentName, newHash))
253-
newActionStorePath := filepath.Join(newHome, filepath.Base(currentActionStorePath))
252+
for _, currentActionStorePath := range storePaths {
253+
newHome := filepath.Join(filepath.Dir(paths.Home()), fmt.Sprintf("%s-%s", agentName, newHash))
254+
newActionStorePath := filepath.Join(newHome, filepath.Base(currentActionStorePath))
254255

255-
currentActionStore, err := ioutil.ReadFile(currentActionStorePath)
256-
if os.IsNotExist(err) {
257-
// nothing to copy
258-
return nil
259-
}
260-
if err != nil {
261-
return err
256+
currentActionStore, err := ioutil.ReadFile(currentActionStorePath)
257+
if os.IsNotExist(err) {
258+
// nothing to copy
259+
continue
260+
}
261+
if err != nil {
262+
return err
263+
}
264+
265+
if err := ioutil.WriteFile(newActionStorePath, currentActionStore, 0600); err != nil {
266+
return err
267+
}
262268
}
263269

264-
return ioutil.WriteFile(newActionStorePath, currentActionStore, 0600)
270+
return nil
265271
}

x-pack/packetbeat/packetbeat.reference.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ packetbeat.flows:
8080

8181
packetbeat.protocols:
8282
- type: icmp
83-
# Enable ICMPv4 and ICMPv6 monitoring. Default: true
83+
# Enable ICMPv4 and ICMPv6 monitoring. The default is true.
8484
#enabled: true
8585

8686
# Set to true to publish fields with null values in events.

x-pack/packetbeat/packetbeat.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ packetbeat.flows:
3838

3939
packetbeat.protocols:
4040
- type: icmp
41-
# Enable ICMPv4 and ICMPv6 monitoring. Default: false
41+
# Enable ICMPv4 and ICMPv6 monitoring. The default is true.
4242
enabled: true
4343

4444
- type: amqp
@@ -47,7 +47,8 @@ packetbeat.protocols:
4747
ports: [5672]
4848

4949
- type: cassandra
50-
#Cassandra port for traffic monitoring.
50+
# Configure the ports where to listen for Cassandra traffic. You can disable
51+
# the Cassandra protocol by commenting out the list of ports.
5152
ports: [9042]
5253

5354
- type: dhcpv4
@@ -112,7 +113,8 @@ packetbeat.protocols:
112113
- 9243 # Elasticsearch
113114

114115
- type: sip
115-
# Configure the ports where to listen for SIP traffic. You can disable the SIP protocol by commenting out the list of ports.
116+
# Configure the ports where to listen for SIP traffic. You can disable
117+
# the SIP protocol by commenting out the list of ports.
116118
ports: [5060]
117119

118120
# ======================= Elasticsearch template setting =======================

0 commit comments

Comments
 (0)