Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
Also some extraction of common strings into consts
  • Loading branch information
tliron committed Oct 29, 2021
1 parent 83cbf5b commit 22c3487
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<puccini.version>0.0.0-SNAPSHOT</puccini.version>
<snakeyaml.version>2.2.1</snakeyaml.version>
<snakeyaml.version>2.3</snakeyaml.version>
</properties>

<groupId>puccini</groupId>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-wrapper-ansible
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-wasm
Original file line number Diff line number Diff line change
Expand Up @@ -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" "$@"
2 changes: 1 addition & 1 deletion tosca/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion tosca/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetEntityTypeName(type_ reflect.Type) string {
// EntityPtrs
//

type EntityPtrs []interface{}
type EntityPtrs []EntityPtr

// sort.Interface

Expand Down
8 changes: 4 additions & 4 deletions tosca/grammars/cloudify_v1_3/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tosca/grammars/tosca_v2_0/capability-filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tosca/grammars/tosca_v2_0/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions tosca/grammars/tosca_v2_0/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
10 changes: 9 additions & 1 deletion tosca/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion tosca/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion wrappers/java/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<puccini.version>0.0.0-SNAPSHOT</puccini.version>
<snakeyaml.version>2.2.1</snakeyaml.version>
<snakeyaml.version>2.3</snakeyaml.version>
</properties>

<groupId>puccini</groupId>
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''\
Expand Down

0 comments on commit 22c3487

Please sign in to comment.