The batch connect template configuration used for this cluster
 @param template [#to_sym, nil] the template type
 @return [Hash] the batch connect configuration
975261
def batch_connect_config(template = nil)
      if template
        @batch_connect_config.fetch(template.to_sym, {}).to_h.symbolize_keys.merge(template: template.to_sym)
      else
        @batch_connect_config
      end
    end
395745
def connection(model_connections):
    

    # for each connection group
    for connection_str in model_connections:

        # the services to connect
        services = connection_str.split(':')
        services.sort()

        service_name = ''.join([service.title() for service in services])

        # the template context
        context = {
            # make sure the first letter is lowercase
            'name': service_name[0].lower() + service_name[1:],
            'services': services,
        }

        render_template(template='common', context=context)
        render_template(template='connection', context=context)
894155
def compile(template)
      v8_context do |context|
        template = template.read if template.respond_to?(:read)
        compiled_handlebars = context.eval("Handlebars.precompile(#{template.to_json})")
        "Handlebars.template(#{compiled_handlebars});"
      end
    end
1122723
def get_template(template):
    
    from cloud_inquisitor.database import db

    tmpl = db.Template.find_one(template_name=template)
    if not tmpl:
        raise InquisitorError('No such template found: {}'.format(template))

    tmplenv = Environment(loader=BaseLoader, autoescape=True)
    tmplenv.filters['json_loads'] = json.loads
    tmplenv.filters['slack_quote_join'] = lambda data: ', '.join('`{}`'.format(x) for x in data)

    return tmplenv.from_string(tmpl.template)
1102233
def templates
      extracted_templates = []

      unless self.templates_list.nil? 
        self.templates_list.each do |template|
          extracted_templates.push(Template.new(template))
        end
      end

      return extracted_templates      
    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
362547
def build_from_template(file)
      context = @options[:context] || {}

      template = IO.read(file)
      eruby = Erubis::Eruby.new(template)
      string = eruby.evaluate(context)
      build_from_string(string, File.dirname(file))
    end
189833
def get_all_templates(server, token):
    
    method = 'GET'
    uri = 'https://' + server + '/template'
    connect.tonicdns_client(uri, method, token, data=False)
198035
@RequestMapping(value = "branches/{branchId}/template/connect", method = RequestMethod.POST)
    public Branch connectTemplateInstance(@PathVariable ID branchId, @RequestBody BranchTemplateInstanceConnectRequest request) {
        return branchTemplateService.connectTemplateInstance(branchId, request);
    }
699533
public function connect($template, $name, $controller=null, $metadata=array())
	{
		if(is_object($template))
			$this->_customRoutes[$name] = $template;
		else
			$this->_routes[$name] = new Route($name, $template);

		if($metadata)
			$this->_metadata[$name] = $metadata;

		if($controller)
			$this->_controllers[$name] = $controller;

		return $this;
	}
814933
def direct_connect!
      models = @model.each_child.to_a
      children_list = []
      new_internal_couplings = Hash.new { |h, k| h[k] = [] }

      i = 0
      while i < models.size
        model = models[i]
        if model.coupled?
          # get internal couplings between atomics that we can reuse as-is in the root model
          model.each_internal_coupling do |src, dst|
            if src.host.atomic? && dst.host.atomic?
              new_internal_couplings[src] << dst
            end
          end
          model.each_child { |c| models << c }
        else
          children_list << model
        end
        i += 1
      end

      cm = @model
      cm.each_child.each { |c| cm.remove_child(c) }
      children_list.each { |c| cm << c }

      find_direct_couplings(cm) do |src, dst|
        new_internal_couplings[src] << dst
      end

      internal_couplings = cm.instance_variable_get(:@internal_couplings).clear
      internal_couplings.merge!(new_internal_couplings)
    end
1230096
def enable_templates!
      @templates          = []
      @enabled_templates  = Set[]
      @disabled_templates = Set[]
      
      enable_template :gem

      # enable the default templates first
      Options::DEFAULT_TEMPLATES.each do |name|
        if (Template.template?(name) && options[name])
          enable_template(name)
        end
      end

      # enable the templates specified by option
      options.each do |name,value|
        if (Template.template?(name) && value)
          enable_template(name)
        end
      end

      # enable any additionally specified templates
      options.templates.each { |name| enable_template(name) }

      # disable any previously enabled templates
      @templates.reverse_each do |template|
        template.disable.each { |name| disable_template(name) }
      end
    end
1122908
def add_template(template, **kwargs):
    
    tmpl = Template()
    tmpl.name = template.name
    if template.description:
        tmpl.description = template.description
    if template.layout:
        tmpl.layout = get_layout_as_string(template.layout)

    db.DBSession.add(tmpl)

    if template.templatetypes is not None:
        types = template.templatetypes
        for templatetype in types:
            ttype = _update_templatetype(templatetype)
            tmpl.templatetypes.append(ttype)

    db.DBSession.flush()
    return tmpl
1327480
def connect(options = {})
      return @pool = options[:pool] if options[:pool]
      options   = options.dup
      timeout   = options.delete(:timeout) || 5
      pool_size = options.delete(:pool_size) || 1
      @pool     = Squirm::Pool.new(timeout)
      pool_size.times do
        conn = PGconn.open(options)
        yield conn if block_given?
        @pool.checkin conn
      end
    end
861882
def render_template_file(template, context=None):
    
    assert isinstance(context, Mapping)
    template = get_template(template)
    return template.render(context)
444115
def get_trigger_by_template(template, trigger_id = nil)
      data = {}
      data['template'] = template
      if trigger_id != nil then data['trigger_id'] = trigger_id end
      api_get(:trigger, data)
    end
707230
def generic_objects_for_object_template(name, params = {})
      api_call(:get, "/object_templates/#{name}/generic_objects", params) do |response|
         Calculated::Models::ObjectTemplate.new(response["object_template"])
      end
    end