diff --git a/go.mod b/go.mod index 9e2c3342b5..746ad377df 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/elastic/package-storage go 1.12 require ( - github.com/elastic/package-registry v0.4.1-0.20200701184232-e93e801a6dfb + github.com/elastic/package-registry v0.4.1-0.20200702132954-41c150c8020e github.com/magefile/mage v1.9.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.4.0 diff --git a/go.sum b/go.sum index fe95401727..22fad2499e 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/elastic/package-registry v0.4.1-0.20200630205652-7ced31a1b229 h1:QWEv github.com/elastic/package-registry v0.4.1-0.20200630205652-7ced31a1b229/go.mod h1:ERTTIxAsQOCVZJDqR4LJbDDAtxV+pz4wdPPrKheiAUc= github.com/elastic/package-registry v0.4.1-0.20200701184232-e93e801a6dfb h1:8fI3eTTxdkoEzIyul+ZzSQ1MAa90i7V1C9CA7r0oiII= github.com/elastic/package-registry v0.4.1-0.20200701184232-e93e801a6dfb/go.mod h1:ERTTIxAsQOCVZJDqR4LJbDDAtxV+pz4wdPPrKheiAUc= +github.com/elastic/package-registry v0.4.1-0.20200702132954-41c150c8020e h1:B0i7PeWOSzKCX+Xba1SSTq7jAJKZK1IMwGfMOTOO/5I= +github.com/elastic/package-registry v0.4.1-0.20200702132954-41c150c8020e/go.mod h1:ERTTIxAsQOCVZJDqR4LJbDDAtxV+pz4wdPPrKheiAUc= github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= diff --git a/vendor/github.com/elastic/package-registry/util/dataset.go b/vendor/github.com/elastic/package-registry/util/dataset.go index c212031f21..a5395a77d1 100644 --- a/vendor/github.com/elastic/package-registry/util/dataset.go +++ b/vendor/github.com/elastic/package-registry/util/dataset.go @@ -21,7 +21,11 @@ import ( ) const ( - DirIngestPipeline = "ingest-pipeline" + DirIngestPipeline = "ingest_pipeline" + + DefaultPipelineName = "default" + DefaultPipelineNameJSON = "default.json" + DefaultPipelineNameYAML = "default.yml" ) var validTypes = map[string]string{ @@ -34,8 +38,10 @@ type Dataset struct { Type string `config:"type" json:"type" validate:"required"` Name string `config:"name" json:"name,omitempty" yaml:"name,omitempty"` - Title string `config:"title" json:"title" validate:"required"` - Release string `config:"release" json:"release"` + Title string `config:"title" json:"title" validate:"required"` + Release string `config:"release" json:"release"` + + // Deprecated: Replaced by elasticsearch.ingest_pipeline.name IngestPipeline string `config:"ingest_pipeline,omitempty" config:"ingest_pipeline" json:"ingest_pipeline,omitempty" yaml:"ingest_pipeline,omitempty"` Streams []Stream `config:"streams" json:"streams,omitempty" yaml:"streams,omitempty" ` Package string `json:"package,omitempty" yaml:"package,omitempty"` @@ -81,6 +87,7 @@ type Variable struct { type Elasticsearch struct { IndexTemplateSettings map[string]interface{} `config:"index_template.settings" json:"index_template.settings,omitempty" yaml:"index_template.settings,omitempty"` IndexTemplateMappings map[string]interface{} `config:"index_template.mappings" json:"index_template.mappings,omitempty" yaml:"index_template.mappings,omitempty"` + IngestPipelineName string `config:"ingest_pipeline.name,omitempty" json:"ingest_pipeline.name,omitempty" yaml:"ingest_pipeline.name,omitempty"` } type fieldEntry struct { @@ -157,11 +164,22 @@ func (d *Dataset) Validate() error { return fmt.Errorf("type is not valid: %s", d.Type) } - if d.IngestPipeline == "" { + if d.Elasticsearch != nil && d.Elasticsearch.IngestPipelineName == "" { + // Check that no ingest pipeline exists in the directory except default + for _, path := range paths { + if filepath.Base(path) == DefaultPipelineNameJSON || filepath.Base(path) == DefaultPipelineNameYAML { + d.Elasticsearch.IngestPipelineName = DefaultPipelineName + // TODO: remove because of legacy + d.IngestPipeline = DefaultPipelineName + break + } + } + // TODO: Remove, only here for legacy + } else if d.IngestPipeline == "" { // Check that no ingest pipeline exists in the directory except default for _, path := range paths { - if filepath.Base(path) == "default.json" || filepath.Base(path) == "default.yml" { - d.IngestPipeline = "default" + if filepath.Base(path) == DefaultPipelineNameJSON || filepath.Base(path) == DefaultPipelineNameYAML { + d.IngestPipeline = DefaultPipelineName break } } diff --git a/vendor/github.com/elastic/package-registry/util/package.go b/vendor/github.com/elastic/package-registry/util/package.go index 61ab0c7844..67a7b27d0a 100644 --- a/vendor/github.com/elastic/package-registry/util/package.go +++ b/vendor/github.com/elastic/package-registry/util/package.go @@ -66,6 +66,9 @@ type Package struct { Datasets []*Dataset `config:"datasets,omitempty" json:"datasets,omitempty" yaml:"datasets,omitempty"` Owner *Owner `config:"owner,omitempty" json:"owner,omitempty" yaml:"owner,omitempty"` + // Introduce it temporary to fix outdated Kibana snapshot + Requirement map[string]interface{} `json:"requirement"` + // Local path to the package dir BasePath string `json:"-" yaml:"-"` } @@ -178,6 +181,8 @@ func NewPackage(basePath string) (*Package, error) { } } + p.Requirement = map[string]interface{}{} + p.Downloads = []Download{NewDownload(*p, "tar")} if p.Conditions != nil && p.Conditions.KibanaVersion != "" { diff --git a/vendor/modules.txt b/vendor/modules.txt index ba294590e2..2ed081e827 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -11,7 +11,7 @@ github.com/davecgh/go-spew/spew github.com/elastic/go-ucfg github.com/elastic/go-ucfg/parse github.com/elastic/go-ucfg/yaml -# github.com/elastic/package-registry v0.4.1-0.20200701184232-e93e801a6dfb +# github.com/elastic/package-registry v0.4.1-0.20200702132954-41c150c8020e github.com/elastic/package-registry/util # github.com/magefile/mage v1.9.0 github.com/magefile/mage/mg