Ask Your Question
0

puppetmaster seems to be caching the output from my ruby

asked 2013-03-27 16:37:43 -0600

paulmiles01 gravatar image

Hello,

I've written my first bit of Ruby which takes a custom fact and then creates a formatted string that I later use in an exec.

  module Puppet::Parser::Functions

  # This function takes a single parameter which is the mount point on disk
  # ie. /mnt/gluster

  newfunction(:gfs_create_options2, :type => :rvalue) do |args|

  ips = Facter['aws_glusterservers'].value

  sMnt_point = args[0]
  iCount = 0

  sNew_string = ""
  ips.split.each do |ipaddr|
    iCount == 0 ? sNew_string = ipaddr : sNew_string = sNew_string + ":" + sMnt_point + " " + ipaddr

    iCount +=1
  end

  sCount = iCount.to_s
  sCreatestring = "replica " + sCount + " transport tcp " + sNew_string + ":" + sMnt_point

  sCreatestring.to_s

  end
end

The problem I have is that my ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-03-28 02:45:22 -0600

jonn gravatar image

I'm guessing that you're always getting the Puppetmaster's aws_glusterservers fact? I think you're pulling the value straight out of the Facter library, and not from the Puppet parser.

Instead of:

ips = Facter['aws_glusterservers'].value

try:

ips = lookupvar('aws_glusterservers')

(referenced here)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-03-27 16:37:43 -0600

Seen: 176 times

Last updated: Mar 28 '13