Knife node edit NODE from file FILE?

Hello,

Is there a way to replace the “attributs” of an existing node in a
non-interactive mode, using knife or another utility please ?

I can see in the documentation that there are the two following knife
sub-commands:

  • node edit NODE (options)
    Edit a node.
  • node from file FILE (options)
    Create a node from a JSON file.

But my need is to ‘edit’ the attributs of an existing node ‘from a file’, so
a kind of merge of this two features :wink:

Thanks in advance for your answers.

Best regards,
Christophe

Hello,

On Thu, Apr 5, 2012 at 11:28 AM, cl.subscription@gmail.com wrote:

Is there a way to replace the "attributs" of an existing node in a
non-interactive mode, using knife or another utility please ?

I can see in the documentation that there are the two following knife
sub-commands:

  • node edit NODE (options)
    Edit a node.
  • node from file FILE (options)
    Create a node from a JSON file.

But my need is to 'edit' the attributs of an existing node 'from a file', so
a kind of merge of this two features :wink:

You can use knife node show with -Fj to dump a node to a JSON file.

knife node show mynode.example.com -Fj > nodes/mynode.example.com.json

Then edit the JSON file as you need and upload it to the server.

knife node from file nodes/mynode.example.com.json

You could also use a "knife exec" script to modify the node with the
same DSL available to shef's main context.

http://wiki.opscode.com/display/chef/Knife+Exec
http://wiki.opscode.com/display/chef/Shef

--
Opscode, Inc
Joshua Timberman, Technical Program Manager
IRC, Skype, Twitter, Github: jtimberman