Skip to content

Commit

Permalink
Merge branch '7.x' of github.com:elastic/beats into backport/7.x/pr-2…
Browse files Browse the repository at this point in the history
…3580

Merge upstream
  • Loading branch information
Eamonn Smith authored and Eamonn Smith committed Jan 26, 2021
2 parents 3eb665b + fe6d96c commit fad7b6c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Fix incorrect hash when upgrading agent {pull}22322[22322]
- Fix refresh of monitoring configuration {pull}23619[23619]
- Fixed nil pointer during unenroll {pull}23609[23609]
- Fixed reenroll scenario {pull}23686[23686]

==== New features

Expand Down
6 changes: 6 additions & 0 deletions x-pack/elastic-agent/pkg/agent/application/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ func (c *EnrollCmd) Execute() error {
return err
}

// clear action store
// fail only if file exists and there was a failure
if err := os.Remove(info.AgentStateStoreFile()); !os.IsNotExist(err) {
return err
}

return nil
}

Expand Down
28 changes: 17 additions & 11 deletions x-pack/elastic-agent/pkg/agent/application/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,25 @@ func rollbackInstall(ctx context.Context, hash string) {
}

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

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

currentActionStore, err := ioutil.ReadFile(currentActionStorePath)
if os.IsNotExist(err) {
// nothing to copy
return nil
}
if err != nil {
return err
currentActionStore, err := ioutil.ReadFile(currentActionStorePath)
if os.IsNotExist(err) {
// nothing to copy
continue
}
if err != nil {
return err
}

if err := ioutil.WriteFile(newActionStorePath, currentActionStore, 0600); err != nil {
return err
}
}

return ioutil.WriteFile(newActionStorePath, currentActionStore, 0600)
return nil
}
2 changes: 1 addition & 1 deletion x-pack/packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ packetbeat.flows:

packetbeat.protocols:
- type: icmp
# Enable ICMPv4 and ICMPv6 monitoring. Default: true
# Enable ICMPv4 and ICMPv6 monitoring. The default is true.
#enabled: true

# Set to true to publish fields with null values in events.
Expand Down
8 changes: 5 additions & 3 deletions x-pack/packetbeat/packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ packetbeat.flows:

packetbeat.protocols:
- type: icmp
# Enable ICMPv4 and ICMPv6 monitoring. Default: false
# Enable ICMPv4 and ICMPv6 monitoring. The default is true.
enabled: true

- type: amqp
Expand All @@ -47,7 +47,8 @@ packetbeat.protocols:
ports: [5672]

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

- type: dhcpv4
Expand Down Expand Up @@ -112,7 +113,8 @@ packetbeat.protocols:
- 9243 # Elasticsearch

- type: sip
# Configure the ports where to listen for SIP traffic. You can disable the SIP protocol by commenting out the list of ports.
# Configure the ports where to listen for SIP traffic. You can disable
# the SIP protocol by commenting out the list of ports.
ports: [5060]

# ======================= Elasticsearch template setting =======================
Expand Down

0 comments on commit fad7b6c

Please sign in to comment.