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

Update imports to elastic-agent-libs/file where needed #31419

Merged
merged 18 commits into from
Apr 29, 2022
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/main' into use-file-from-libs
  • Loading branch information
kvch committed Apr 29, 2022
commit 49cebe4f12eafc8afdf8e917658923a493a3dd91
2 changes: 1 addition & 1 deletion filebeat/inputsource/unix/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"github.com/stretchr/testify/require"

"github.com/elastic/beats/v7/filebeat/inputsource"
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/logp"
conf "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/file"
)

Expand Down
7 changes: 4 additions & 3 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import (
"github.com/elastic/beats/v7/libbeat/publisher/processing"
svc "github.com/elastic/beats/v7/libbeat/service"
"github.com/elastic/beats/v7/libbeat/version"
"github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/file"
"github.com/elastic/elastic-agent-libs/mapstr"
sysinfo "github.com/elastic/go-sysinfo"
Expand Down Expand Up @@ -1137,8 +1138,8 @@ func LoadKeystore(cfg *config.C, name string) (keystore.Keystore, error) {
return keystore.Factory(keystoreCfg, defaultPathConfig)
}

func InitKibanaConfig(beatConfig beatConfig) *common.Config {
var esConfig *common.Config
func InitKibanaConfig(beatConfig beatConfig) *config.C {
var esConfig *config.C
if isElasticsearchOutput(beatConfig.Output.Name()) {
esConfig = beatConfig.Output.Config()
}
Expand Down Expand Up @@ -1171,7 +1172,7 @@ func isElasticsearchOutput(name string) bool {
return name == "elasticsearch"
}

func initPaths(cfg *common.Config) error {
func initPaths(cfg *config.C) error {
// To Fix the chicken-egg problem with the Keystore and the loading of the configuration
// files we are doing a partial unpack of the configuration file and only take into consideration
// the paths field. After we will unpack the complete configuration and keystore reference
Expand Down
1 change: 1 addition & 0 deletions libbeat/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"runtime"

"github.com/elastic/beats/v7/libbeat/logp"
"github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/file"
ucfg "github.com/elastic/go-ucfg"
"github.com/elastic/go-ucfg/cfgutil"
Expand Down
5 changes: 3 additions & 2 deletions libbeat/keystore/file_keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"golang.org/x/crypto/pbkdf2"

"github.com/elastic/beats/v7/libbeat/common"
c "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/file"
)

Expand Down Expand Up @@ -173,7 +174,7 @@ func (k *FileKeystore) List() ([]string, error) {

// GetConfig returns config.C representation of the key / secret pair to be merged with other
// loaded configuration.
func (k *FileKeystore) GetConfig() (*config.C, error) {
func (k *FileKeystore) GetConfig() (*c.C, error) {
k.RLock()
defer k.RUnlock()

Expand All @@ -182,7 +183,7 @@ func (k *FileKeystore) GetConfig() (*config.C, error) {
configHash[key] = string(secret.Value)
}

return config.NewConfigFrom(configHash)
return c.NewConfigFrom(configHash)
}

// Create create an empty keystore, if the store already exist we will return an error.
Expand Down
2 changes: 1 addition & 1 deletion libbeat/outputs/fileout/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"path/filepath"

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/outputs"
"github.com/elastic/beats/v7/libbeat/outputs/codec"
"github.com/elastic/beats/v7/libbeat/publisher"
c "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/file"
"github.com/elastic/elastic-agent-libs/logp"
)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.