I am trying to create an amazon EC2 instance using "knife ec2 server create" and passing in JSON to override the default settings by using the -j option where $json is properly formed JSON text and I get the same error if I quote the variable or not:
PS C:\Users\chef> knife ec2 server create --region ... -j $json
It fails with this error:
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `initialize': A JSON text must
at least contain two octets! (JSON::ParserError)
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `new'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
from C:/Users/chef/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-ec2-0.12.0/lib/chef/knife/ec2_server_create.rb
:218:in `block in <class:Ec2ServerCreate>'
If I attempt to place the JSON on the command line I get a different error:
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token
at '{fusion_**** : *** }' (JSON::ParserError)
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
from C:/Users/chef/AppData/Local/chefdk/gem/ruby/2.1.0/gems/knife-ec2-0.12.0/lib/chef/knife/ec2_server_create.rb
:218:in `block in <class:Ec2ServerCreate>'
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:235:in `call'
I have been unable to find any known issues with knife and PowerShell and while it does work with the minimal JSON of "{}", it does not appear to work with anything else.
Anyone have this working for themselves?