diff --git a/examples/java/pom.xml b/examples/java/pom.xml
index 5a77f66a..2388e11d 100644
--- a/examples/java/pom.xml
+++ b/examples/java/pom.xml
@@ -8,7 +8,7 @@
1.8
UTF-8
0.0.0-SNAPSHOT
- 2.2.1
+ 2.3
puccini
diff --git a/go.mod b/go.mod
index ee073645..fba92c73 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.17
// replace github.com/tliron/kutil => /Depot/Projects/RedHat/kutil
require (
- github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48
+ github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06
github.com/fxamacker/cbor/v2 v2.3.0
github.com/segmentio/ksuid v1.0.4
github.com/spf13/cobra v1.2.1
diff --git a/go.sum b/go.sum
index 3ad6e86c..f27a8c86 100644
--- a/go.sum
+++ b/go.sum
@@ -283,8 +283,8 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNE
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dop251/goja v0.0.0-20210810150349-acd0507c3d6f/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
-github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48 h1:iZOop7pqsg+56twTopWgwCGxdB5SI2yDO8Ti7eTRliQ=
-github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
+github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06 h1:XqC5eocqw7r3+HOhKYqaYH07XBiBDp9WE3NQK8XHSn4=
+github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
diff --git a/scripts/build-wrapper-ansible b/scripts/build-wrapper-ansible
index fa28918c..60a3c73b 100755
--- a/scripts/build-wrapper-ansible
+++ b/scripts/build-wrapper-ansible
@@ -18,7 +18,7 @@ mkdir --parents "$DIST"
SUFFIX=$SUFFIX "$HERE/build-wrapper-python" -e
. "$VENV/bin/activate"
-python -m pip install ansible==3.3.0
+python -m pip install ansible==4.7.0
ansible-galaxy collection build \
"$ROOT/wrappers/ansible/ansible_collections/puccini/tosca" \
diff --git a/scripts/test-wasm b/scripts/test-wasm
index 130f548f..ea66b4fd 100755
--- a/scripts/test-wasm
+++ b/scripts/test-wasm
@@ -15,7 +15,7 @@ WASM_EXEC=$(go env GOROOT)/misc/wasm/go_js_wasm_exec
function run () {
local TOOL=$1
- "$WASM_EXEC" "$ROOT/dist/$TOOL.wasm" "${@:2}"
+ env --ignore-environment "$WASM_EXEC" "$ROOT/dist/$TOOL.wasm" "${@:2}"
}
run puccini-tosca compile "$ROOT/examples/openstack/hello-world.yaml" "$@"
diff --git a/tosca/context.go b/tosca/context.go
index 51b109da..f43236b2 100644
--- a/tosca/context.go
+++ b/tosca/context.go
@@ -31,7 +31,7 @@ func GetContext(entityPtr EntityPtr) *Context {
func GetCanonicalName(entityPtr EntityPtr) string {
if metadata, ok := GetMetadata(entityPtr); ok {
- if canonicalName, ok := metadata["canonical_name"]; ok {
+ if canonicalName, ok := metadata[METADATA_CANONICAL_NAME]; ok {
return canonicalName
}
}
diff --git a/tosca/entity.go b/tosca/entity.go
index ad4aaa86..76dc802c 100644
--- a/tosca/entity.go
+++ b/tosca/entity.go
@@ -24,7 +24,7 @@ func GetEntityTypeName(type_ reflect.Type) string {
// EntityPtrs
//
-type EntityPtrs []interface{}
+type EntityPtrs []EntityPtr
// sort.Interface
diff --git a/tosca/grammars/cloudify_v1_3/metadata.go b/tosca/grammars/cloudify_v1_3/metadata.go
index 98372640..88280103 100644
--- a/tosca/grammars/cloudify_v1_3/metadata.go
+++ b/tosca/grammars/cloudify_v1_3/metadata.go
@@ -28,16 +28,16 @@ func ReadMetadata(context *tosca.Context) tosca.EntityPtr {
if self != nil {
for key, value := range self {
- if strings.HasPrefix(key, "puccini.scriptlet.import:") {
+ if strings.HasPrefix(key, tosca.METADATA_SCRIPTLET_IMPORT_PREFIX) {
if v, ok := value.(string); ok {
- context.ImportScriptlet(key[25:], v)
+ context.ImportScriptlet(key[len(tosca.METADATA_SCRIPTLET_IMPORT_PREFIX):], v)
delete(self, key)
} else {
context.MapChild(key, value).ReportValueWrongType(ard.TypeString)
}
- } else if strings.HasPrefix(key, "puccini.scriptlet:") {
+ } else if strings.HasPrefix(key, tosca.METADATA_SCRIPTLET_PREFIX) {
if v, ok := value.(string); ok {
- context.EmbedScriptlet(key[18:], v)
+ context.EmbedScriptlet(key[len(tosca.METADATA_SCRIPTLET_PREFIX):], v)
delete(self, key)
} else {
context.MapChild(key, value).ReportValueWrongType(ard.TypeString)
diff --git a/tosca/grammars/tosca_v2_0/capability-filter.go b/tosca/grammars/tosca_v2_0/capability-filter.go
index 07eac65d..f4c3e306 100644
--- a/tosca/grammars/tosca_v2_0/capability-filter.go
+++ b/tosca/grammars/tosca_v2_0/capability-filter.go
@@ -42,6 +42,8 @@ func (self CapabilityFilter) Normalize(normalRequirement *normal.Requirement) no
return nil
}
+ // TODO: separate maps for by-name vs. by-type-name
+
var normalFunctionCallMap normal.FunctionCallMap
var ok bool
if normalFunctionCallMap, ok = normalRequirement.CapabilityPropertyConstraints[self.Name]; !ok {
diff --git a/tosca/grammars/tosca_v2_0/import.go b/tosca/grammars/tosca_v2_0/import.go
index 566dd76c..c0e0ad34 100644
--- a/tosca/grammars/tosca_v2_0/import.go
+++ b/tosca/grammars/tosca_v2_0/import.go
@@ -123,7 +123,7 @@ func newImportNameTransformer(prefix *string, appendShortCutnames bool) tosca.Na
var names []string
if metadata, ok := tosca.GetMetadata(entityPtr); ok {
- if normative, ok := metadata["tosca.normative"]; ok {
+ if normative, ok := metadata[tosca.METADATA_NORMATIVE]; ok {
if normative == "true" {
// Reserved "tosca." names also get shorthand and prefixed names
names = getNormativeNames(entityPtr, names, name, "tosca", appendShortCutnames)
@@ -165,7 +165,7 @@ func getNormativeNames(entityPtr tosca.EntityPtr, names []string, name string, p
names = append(names, fmt.Sprintf("%s:%s", prefix, short))
// Override canonical name
- tosca.SetMetadata(entityPtr, "canonical_name", fmt.Sprintf("%s::%s", prefix, short))
+ tosca.SetMetadata(entityPtr, tosca.METADATA_CANONICAL_NAME, fmt.Sprintf("%s::%s", prefix, short))
// Shortcut
if appendShortcut {
diff --git a/tosca/grammars/tosca_v2_0/metadata.go b/tosca/grammars/tosca_v2_0/metadata.go
index 41859f8c..ef531557 100644
--- a/tosca/grammars/tosca_v2_0/metadata.go
+++ b/tosca/grammars/tosca_v2_0/metadata.go
@@ -26,11 +26,11 @@ func ReadMetadata(context *tosca.Context) tosca.EntityPtr {
if self != nil {
for key, value := range self {
- if strings.HasPrefix(key, "puccini.scriptlet.import:") {
- context.ImportScriptlet(key[25:], value)
+ if strings.HasPrefix(key, tosca.METADATA_SCRIPTLET_IMPORT_PREFIX) {
+ context.ImportScriptlet(key[len(tosca.METADATA_SCRIPTLET_IMPORT_PREFIX):], value)
delete(self, key)
- } else if strings.HasPrefix(key, "puccini.scriptlet:") {
- context.EmbedScriptlet(key[18:], value)
+ } else if strings.HasPrefix(key, tosca.METADATA_SCRIPTLET_PREFIX) {
+ context.EmbedScriptlet(key[len(tosca.METADATA_SCRIPTLET_PREFIX):], value)
delete(self, key)
}
}
diff --git a/tosca/metadata.go b/tosca/metadata.go
index fa033e30..4b09da7b 100644
--- a/tosca/metadata.go
+++ b/tosca/metadata.go
@@ -4,6 +4,14 @@ import (
"strings"
)
+const (
+ METADATA_INFORMATION_PREFIX = "puccini.information:"
+ METADATA_SCRIPTLET_PREFIX = "puccini.scriptlet:"
+ METADATA_SCRIPTLET_IMPORT_PREFIX = "puccini.scriptlet.import:"
+ METADATA_CANONICAL_NAME = "tosca.canonical-name"
+ METADATA_NORMATIVE = "tosca.normative"
+)
+
//
// HasMetadata
//
@@ -44,7 +52,7 @@ func GetInformationMetadata(metadata map[string]string) map[string]string {
informationMetadata := make(map[string]string)
if metadata != nil {
for key, value := range metadata {
- if strings.HasPrefix(key, "puccini.information:") {
+ if strings.HasPrefix(key, METADATA_INFORMATION_PREFIX) {
informationMetadata[key[20:]] = value
}
}
diff --git a/tosca/namespace.go b/tosca/namespace.go
index e09eafdc..0f967d13 100644
--- a/tosca/namespace.go
+++ b/tosca/namespace.go
@@ -42,7 +42,7 @@ func NewNamespaceFor(entityPtr EntityPtr) *Namespace {
if context.HasQuirk(QuirkNamespaceNormativeIgnore) {
// Do not add normative types to the namespace
if metadata, ok := GetMetadata(entityPtr); ok {
- if normative, ok := metadata["tosca.normative"]; ok {
+ if normative, ok := metadata[METADATA_NORMATIVE]; ok {
if normative == "true" {
continue
}
diff --git a/wrappers/java/java/pom.xml b/wrappers/java/java/pom.xml
index 375563ec..efecb2f3 100644
--- a/wrappers/java/java/pom.xml
+++ b/wrappers/java/java/pom.xml
@@ -16,7 +16,7 @@
1.8
UTF-8
0.0.0-SNAPSHOT
- 2.2.1
+ 2.3
puccini
diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py
index 433f1a8f..f9b39a2e 100755
--- a/wrappers/python/setup.py
+++ b/wrappers/python/setup.py
@@ -15,7 +15,7 @@
with open(os.path.join(os.path.dirname(__file__), 'description.md')) as f:
description = f.read()
-go_version = os.environ.get('PUCCINI_GO_VERSION', '1.17')
+go_version = os.environ.get('PUCCINI_GO_VERSION', '1.17.2')
root = os.path.abspath(os.path.dirname(__file__)).replace('"', '\\"')
script = '''\