def create_node(object, data = {})
      if object.is_a?(Chef::Node)
        name = object.name
        data = object.to_json
      else
        name = object.to_s
        data[:name] ||= name
        data = JSON.fast_generate(data)
      end

      load_data(name, 'nodes', data)
    end
def create_node(object, data = {})
      if object.is_a?(Chef::Node)
        name = object.name
        data = object.to_json
      else
        name = object.to_s
        data[:name] ||= name
        data = JSON.fast_generate(data)
      end

      load_data(name, 'nodes', data)
    end
Create a new node on the Chef Server. This overrides the method created
 by {entity}, permitting users to pass a raw +Chef::Node+ object in
 addition to a hash.

 @example Create a node from a hash

   create_node('bacon', attribute: 'value')

 @example Create a node from a +Chef::Node+ object

   node = stub_node('bacon', platform: 'ubuntu', version: '18.04')
   create_node(node)

 @param [String, Chef::Node] object
   the object to create; this can be the name of the node, or an actual
   +Chef::Node+ object
 @param [Hash] data
   the list of data to populate the node with; this is ignored if an
   actual node object is given