小编Rau*_*res的帖子

从Puppet自定义类型访问hiera范围

我正在构建一个自定义类型,我无法从defaultto块访问hiera范围

module Puppet
  require 'puppet/parser/functions/hiera' 
  newtype(:my_type) do

    ensurable

    newparam(:myparam) do
      defaultto { Puppet::Parser::Functions.hiera('myparam') }
    end
    newproperty(:value) do
        desc "Value of the item."
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

但我明白了

Error: undefined method `hiera' for Puppet::Parser::Functions:Module
Run Code Online (Sandbox Code Playgroud)

我实际上正在使用Puppet 3.8和未来的解析器

作为一种解决方法,我们使用

  $my_vals = hiera_hash('mytype_vals')
  create_resource(my_type, $myvals, {myparam => hiera('myparam')})
Run Code Online (Sandbox Code Playgroud)

这样可以正常工作,但是my_type期望在目录中的任何地方实例化对象,并且预期myparam所有实例中的对象都是相同的.因此,不需要多个默认值声明.

另一种方法是放置

My_type{
  myparam => hiera('myparam')
}
Run Code Online (Sandbox Code Playgroud)

在节点清单中.这也可以解决问题,但我们正在开发一个模块,主要清单超出了我们的范围

puppet hiera

7
推荐指数
1
解决办法
337
查看次数

合并分支后推送时无法解析引用refs/refs/remotes/origin/branch

git和github的新功能.

我想在本地和远程替换master我的其他分支的git 分支bridge.问题是git无法解析bridge分支的引用.问题来自推向github.

git树是如何形成的:

  1. 通过Git GUI启动master分支.
  2. 继续然后意识到它并不那么伟大并且转变为Bash.
  3. 由于本地主分支的提示落后于远程对手的一端,因此无法再向github推送.
  4. 为了规避,我创建了另一个名为bridge的分支.我不喜欢我已将网桥设为默认设置,因此我尝试将其更改为主设备使用:

    git checkout better_branch
    git merge --strategy=ours master    # keep the content of this branch, but record a merge
    git checkout master
    git merge better_branch             # fast-forward master up to the merge
    
  5. 它在当地工作.但是,当我试图推动时,我得到以下内容:

    NAME@**** /C/Users/NAME/Documents/GitHub/tabtrack (master)
    $ git push
    warning: push.default is unset; its implicit value is changing in
    Git 2.0 from 'matching' to 'simple'. To squelch this message
    and maintain the current behavior after the …

git github git-bash

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

git ×1

git-bash ×1

github ×1

hiera ×1

puppet ×1