(see SoloRunner#apply_chef_config!)
776759
def apply_chef_config!
      super
      Chef::Config[:client_key]       = client_key
      Chef::Config[:client_name]      = 'chefspec'
      Chef::Config[:node_name]        = 'chefspec'
      Chef::Config[:solo]             = false
      Chef::Config[:solo_legacy_mode] = false

      Chef::Config[:chef_server_url]  = server.url
      Chef::Config[:http_retry_count] = 0
    end
770576
def apply_patch(self, filename, arch, build_dir=None):
        
        info("Applying patch {}".format(filename))
        build_dir = build_dir if build_dir else self.get_build_dir(arch)
        filename = join(self.get_recipe_dir(), filename)
        shprint(sh.patch, "-t", "-d", build_dir, "-p1",
                "-i", filename, _tail=10)
114101
def apply(self):
        
        log = self._params.get('log', self._discard)
        if not self._config_pending:
            raise TaskError(self._name, "No configuration available to apply")

        control = self._config_pending.get('control')
        if not control:
            control = 'wait'

        log.debug("for '%s', control '%s'", self._name, control)
        if self._command_change() and len(self.get_pids()) > 0:
            self._event_deregister()
            self.stop(task_is_resetting=True)

        self._config_running = self._config_pending
        self._context = self._context_build()

        if control in self._legion.run_controls:
            self._event_register(control)
        return self.manage()
69326
public function prepareCooking(): callable
    {
        return function (array $workPlan, ChefInterface $chef): RecipeInterface {
            /**
             * @var Recipe $this
             */
            foreach ($this->requiredIngredients as $ingredient) {
                $ingredient->prepare($workPlan, $chef);
            }

            return $this;
        };
    }
525015
def converge_block(&block)
      converge do
        recipe = Chef::Recipe.new(cookbook_name, '_test', run_context)
        recipe.instance_exec(&block)
      end
    end
227508
def chef_client_search(name, run_list, environment)
      search = []
      search.push("name:#{name}") if name
      search.push("chef_environment:#{environment}") if environment
      run_list.split(",").each do |item|
        item.sub!(/\[/, ":")
        item.chop!
        item.sub!(/::/, '\:\:')
        search.push(item)
      end
      "#{search.join(' AND ')}"
    end
332688
def add_cookbook_mgmt_options(parser):
    
    cookbook = parser.add_parser('cookbook', help='Invoke in a Jenkins job to '
                                                  'update a cookbook in '
                                                  'chef-repo')
    cookbook.add_argument('repo', action='store',
                          help='Git URL for chef-repo')
    cookbook.set_defaults(func='process_cookbook')
1342869
def run_cmd(command_class, args)
      command = command_class.new(args)
      command.config[:config_file] = config[:config_file]
      command.configure_chef
      command_class.load_deps
      command.run

      command
    end
1095598
def method_missing(m, *args, &block)
      if block = ChefSpec.matchers[resource_name(m.to_sym)]
        instance_exec(args.first, &block)
      else
        super
      end
    end
206390
def load_recipe(self, recipe):
    
    self.recipe = recipe
    for module_description in recipe['modules']:
      # Combine CLI args with args from the recipe description
      module_name = module_description['name']
      module = self.config.get_module(module_name)(self)
      self._module_pool[module_name] = module
909982
def recipe_compile(backend, kitchen, recipe, variation):
    
    err_str, use_kitchen = Backend.get_kitchen_from_user(kitchen)
    if use_kitchen is None:
        raise click.ClickException(err_str)

    if recipe is None:
        recipe = DKRecipeDisk.find_recipe_name()
        if recipe is None:
            raise click.ClickException('You must be in a recipe folder, or provide a recipe name.')

    click.secho('%s - Get the Compiled OrderRun of Recipe %s.%s in Kitchen %s' % (get_datetime(), recipe, variation, use_kitchen),
                fg='green')
    check_and_print(DKCloudCommandRunner.get_compiled_serving(backend.dki, use_kitchen, recipe, variation))
464195
def nuke!
      @server = ChefZero::Server.new(
        # Set the log level from RSpec, defaulting to warn
        log_level:  RSpec.configuration.log_level || :warn,
        port: RSpec.configuration.server_runner_port,

        # Set the data store
        data_store: data_store(RSpec.configuration.server_runner_data_store),
      )
      @cookbooks_uploaded = false
      @data_loaded = {}
    end
1153732
def template_finder(chef_run, cookbook_name)
      if Chef::Provider.const_defined?(:TemplateFinder) # Chef 11+
        Chef::Provider::TemplateFinder.new(chef_run.run_context, cookbook_name, chef_run.node)
      else
        nil
      end
    end
77625
def _node_runner():
    """"""
    env.host_string = lib.get_env_host_string()
    node = lib.get_node(env.host_string)

    _configure_fabric_for_platform(node.get("platform"))

    if __testing__:
        print "TEST: would now configure {0}".format(env.host_string)
    else:
        lib.print_header("Configuring {0}".format(env.host_string))
        if env.autodeploy_chef and not chef.chef_test():
            deploy_chef(ask="no")
        chef.sync_node(node)
300044
def run_recipe(recipe, task, rinput, workenv, logger_control):
    """"""

    # Creating custom logger file
    recipe_logger = logging.getLogger(logger_control['default'])

    if logger_control['enabled']:
        logfile = os.path.join(workenv.resultsdir, logger_control['logfile'])
        logformat = logger_control['format']
        _logger.debug('creating file logger %r from Recipe logger', logfile)
        fh = create_recipe_file_logger(recipe_logger, logfile, logformat)
    else:
        fh = logging.NullHandler()

    recipe_logger.addHandler(fh)

    with working_directory(workenv.workdir):
        try:
            run_recipe_timed(task, recipe, rinput)
            return task
        finally:
            recipe_logger.removeHandler(fh)
558040
def run(argv = ARGV)
      # => Parse CLI Configuration
      cli = Options.new
      cli.parse_options(argv)

      # => Grab the Default Values
      default = Config.options

      # => Parse JSON Config File (If Specified and Exists)
      json_config = Util.parse_json_config(cli.config[:config_file] || Config.config_file)

      # => Merge Configuration (CLI Wins)
      config = [default, json_config, cli.config].compact.reduce(:merge)

      # => Apply Configuration
      Config.setup do |cfg|
        cfg.config_file         = config[:config_file]
        cfg.cache_timeout       = config[:cache_timeout].to_i
        cfg.bind                = config[:bind]
        cfg.port                = config[:port]
        cfg.auth_file           = config[:auth_file]
        cfg.state_file          = config[:state_file]
        cfg.environment         = config[:environment].to_sym.downcase
        cfg.chef_api_endpoint   = config[:chef_api_endpoint]
        cfg.chef_api_client     = config[:chef_api_client]
        cfg.chef_api_client_key = config[:chef_api_client_key]
        cfg.chef_api_admin      = config[:chef_api_admin]
        cfg.chef_api_admin_key  = config[:chef_api_admin_key]
        cfg.rd_node_username    = config[:rd_node_username]
      end

      # => Launch the API
      API.run!
    end
87431
private function prepare(): callable
    {
        return function (): void {
            /**
             * @var Chef $this
             */
            $this->recipe->prepare($this->workPlan, $this);

            $this->checkMissingIngredients();

            $this->position = 0;
        };
    }