Comments (5)
Code tracing: the first line of the error message is reported in daisy.go#main()
, specifically around line 197, within if err:= w.Run(ctx);
. Digging into workflow.go#Run(ctx)
, it calls Validate(ctx)
, which contains the string "error populating workflow". Validate(ctx)
calls populate(ctx)
, which in turn calls populateStep(ctx, step)
, which finally calls step.go#stepImpl()
, the source of the string "no step type defined". So that's where all the parts of this error message come from.
Before the workflow is run, however, it is unmarshalled from a JSON object. This includes unmarshalling all of its steps. This happens in workflow.go#readWorkflow(file, w)
. Unfortunately, it looks like invalid step types are simply ignored. https://golang.org/pkg/encoding/json/#Unmarshal says:
To unmarshal JSON into a struct, Unmarshal matches incoming object keys to the keys used by Marshal (either the struct field name or its tag), preferring an exact match but also accepting a case-insensitive match. Unmarshal will only set exported fields of the struct.
Furthermore:
If a JSON value is not appropriate for a given target type ... Unmarshal skips that field and completes the unmarshaling as best it can.
So, as it stands, misspelled step types are just dropped silently on the floor.
But there is hope:
To unmarshal JSON into a value implementing the Unmarshaler interface, Unmarshal calls that value's UnmarshalJSON method, including when the input is a JSON null. Otherwise, if the value implements encoding.TextUnmarshaler and the input is a JSON quoted string, Unmarshal calls that value's UnmarshalText method with the unquoted form of the string.
So, if we add an UnmarshalJSON
method to our Workflow
type, then we could do the error checking. I'm yet unsure how much work this would take.
from compute-image-tools.
After further consideration, I have two conclusions:
- It makes more sense to only make
Step
implement theUnmarshaler
interface, and - It does indeed make sense, given the funny way we represent steps (specifically their type) in JSON, to write custom unmarshalling logic for steps.
Happily, to implement Unmarshaler
, it only takes one method. I'll get right to it.
from compute-image-tools.
See this, should be in go 1.10:
https://go-review.googlesource.com/c/go/+/74830
from compute-image-tools.
Awesome! Alright, I'll just wait until that's released, then we can use that.
from compute-image-tools.
Partial fix out: #255
Reports the offending step name when there is a step population error.
from compute-image-tools.
Related Issues (20)
- Incorrect hostname for VMs with multiple network interfaces
- panic: runtime error: invalid memory address or nil pointer dereference on Ubuntu 20.04
- Issue with bootstrap_install.ps1 HOT 2
- `import_precheck` fails on CentOS 7 HOT 2
- importing process interrupted when `/etc/netplan` contains subdirectory (Ubuntu 18+) HOT 1
- getting error while importing my ubuntu 2004vmdk into compute instance HOT 1
- Execution fails when shielded VMs org policy is enforced HOT 3
- GCE_Export Release Version access_denied HOT 1
- daisy release version has access denied HOT 1
- Should this be more than 1 GB?
- gcloud compute images import does not allow centos-8 in option --os HOT 1
- Compute engine create with container + SSD
- Could not fetch resource
- Semidev1
- Shared VPC issue during build
- Deployments of UBUNTU with "snapd" (google tool use this snapd?) HOT 3
- windows-startup-script-url: Message: Either the Name or Index parameter is required HOT 2
- Workflow update required for windows-10-20h2-ent-x86
- Fix the setting for 'x86_build' and maybe 'uefi_build' on the 'windows-build-bios.wf.json'
- Create custom Windows BYOL images failed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compute-image-tools.