Skip to content

Commit

Permalink
Remove struct TE
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
  • Loading branch information
Kevin Zhao committed Apr 12, 2018
1 parent 0028ca2 commit 8f026cc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 36 deletions.
24 changes: 22 additions & 2 deletions openstack/container/v1/capsules/template.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
package capsules

// Template is a structure that represents OpenStack Heat templates
import (
"encoding/json"

"gopkg.in/yaml.v2"
)

type Template struct {
TE
// Bin stores the contents of the template or environment.
Bin []byte
// Parsed contains a parsed version of Bin. Since there are 2 different
// fields referring to the same value, you must be careful when accessing
// this filed.
Parsed map[string]interface{}
}

// Parse will parse the contents and then validate. The contents MUST be either JSON or YAML.
func (t *Template) Parse() error {
if jerr := json.Unmarshal(t.Bin, &t.Parsed); jerr != nil {
if yerr := yaml.Unmarshal(t.Bin, &t.Parsed); yerr != nil {
return ErrInvalidDataFormat{}
}
}
return nil
}
32 changes: 0 additions & 32 deletions openstack/container/v1/capsules/utils.go

This file was deleted.

4 changes: 2 additions & 2 deletions openstack/orchestration/v1/stacks/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func (t *Template) Validate() error {
}

// GetFileContents recursively parses a template to search for urls. These urls
// are assumed to point to other templates.
// The contents of these urls are fetched and stored in the `Files`
// are assumed to point to other templates (known in OpenStack Heat as child
// templates). The contents of these urls are fetched and stored in the `Files`
// parameter of the template structure. This is the only way that a user can
// use child templates that are located in their filesystem; urls located on the
// web (e.g. on github or swift) can be fetched directly by Heat engine.
Expand Down

0 comments on commit 8f026cc

Please sign in to comment.