Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.14](backport #39064) Agentbeat: remove unused files from package and silence new error message #39159

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-tools/packaging/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func checkConfigPermissionsWithMode(t *testing.T, p *packageFile, expectedMode o
return
}
}
t.Errorf("no config file found matching %v", configFilePattern)
t.Logf("no config file found matching %v", configFilePattern)
})
}

Expand All @@ -288,7 +288,7 @@ func checkConfigOwner(t *testing.T, p *packageFile, expectRoot bool) {
return
}
}
t.Errorf("no config file found matching %v", configFilePattern)
t.Logf("no config file found matching %v", configFilePattern)
})
}

Expand Down
6 changes: 5 additions & 1 deletion filebeat/fileset/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"encoding/json"
"errors"
"fmt"
"io/ioutil"

Check failure on line 24 in filebeat/fileset/modules.go

View workflow job for this annotation

GitHub Actions / lint (windows)

SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)

Check failure on line 24 in filebeat/fileset/modules.go

View workflow job for this annotation

GitHub Actions / lint (linux)

SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
"os"
"path/filepath"
"strings"
Expand All @@ -29,6 +29,7 @@
"gopkg.in/yaml.v2"

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/libbeat/common/fleetmode"
conf "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/paths"
Expand Down Expand Up @@ -149,8 +150,11 @@
stat, err := os.Stat(modulesPath)
if err != nil || !stat.IsDir() {
log := logp.NewLogger(logName)
log.Errorf("Not loading modules. Module directory not found: %s", modulesPath)
if !fleetmode.Enabled() {
// When run under agent via agentbeat there is no modules directory and this is expected.
log.Errorf("Not loading modules. Module directory not found: %s", modulesPath)
}
return &ModuleRegistry{log: log}, nil //nolint:nilerr // empty registry, no error

Check failure on line 157 in filebeat/fileset/modules.go

View workflow job for this annotation

GitHub Actions / lint (windows)

directive `//nolint:nilerr // empty registry, no error` is unused for linter "nilerr" (nolintlint)

Check failure on line 157 in filebeat/fileset/modules.go

View workflow job for this annotation

GitHub Actions / lint (linux)

directive `//nolint:nilerr // empty registry, no error` is unused for linter "nilerr" (nolintlint)
}

var modulesCLIList []string
Expand Down
31 changes: 0 additions & 31 deletions x-pack/agentbeat/dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ shared:
NOTICE.txt:
source: '{{ repo.RootDir }}/NOTICE.txt'
mode: 0644
README.md:
template: '{{ elastic_beats_dir }}/dev-tools/packaging/templates/common/README.md.tmpl'
mode: 0644
.build_hash.txt:
content: >
{{ commit }}
Expand All @@ -35,32 +32,6 @@ shared:
source: '{{.BeatName}}.spec.yml'
mode: 0644

- &config_files
'auditbeat.yml':
source: '{{ repo.RootDir }}/x-pack/auditbeat/auditbeat.yml'
mode: 0600
config: true
'filebeat.yml':
source: '{{ repo.RootDir }}/x-pack/filebeat/filebeat.yml'
mode: 0600
config: true
'heartbeat.yml':
source: '{{ repo.RootDir }}/x-pack/heartbeat/heartbeat.yml'
mode: 0600
config: true
'metricbeat.yml':
source: '{{ repo.RootDir }}/x-pack/metricbeat/metricbeat.yml'
mode: 0600
config: true
'osquerybeat.yml':
source: '{{ repo.RootDir }}/x-pack/osquerybeat/osquerybeat.yml'
mode: 0600
config: true
'packetbeat.yml':
source: '{{ repo.RootDir }}/x-pack/packetbeat/packetbeat.yml'
mode: 0600
config: true

- &unix_osquery_files
'osquery-extension.ext':
source: '{{ repo.RootDir }}/x-pack/osquerybeat/ext/osquery-extension/build/golang-crossbuild/osquery-extension-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}}'
Expand All @@ -76,14 +47,12 @@ shared:
<<: *common
files:
<<: *binary_files
<<: *config_files
<<: *unix_osquery_files

- &windows_binary_spec
<<: *common
files:
<<: *binary_files
<<: *config_files
<<: *windows_osquery_files

# License modifiers for the Elastic License
Expand Down
Loading