Amend Environmental Cookbook Constraint without interactive input

Hi Chefs,

I'm a bit lost as I cannot see how you use knife commands to edit an existing environmental cookbook restraint to be included in a pipeline (non-interactive).

e.g. Chef Manage / Policy / Environments / #NAME#
NAME = 3.0.0

knife environment edit dev

will prompt with json and wait to be closed - i.e. cant be used in pipeline.

"name": "dev",
"description": "The DEV environment for self contained servers",
"cookbook_versions": {
"cookbook_name": "= 0.4.0"
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {

"override_attributes": {


Do you have to delete the environment and then create from a json file?

many thanks to anyone that can help!