Last modified: 2013-10-09 15:40:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40524, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38524 - [OPS] puppet has undefined function get_var
[OPS] puppet has undefined function get_var
Status: RESOLVED WONTFIX
Product: Wikimedia Labs
Classification: Unclassified
Infrastructure (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Ryan Lane
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-20 16:25 UTC by Antoine "hashar" Musso (WMF)
Modified: 2013-10-09 15:40 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Antoine "hashar" Musso (WMF) 2012-07-20 16:25:45 UTC
deployment-cache-upload03 is setup with the following classes:

  role::cache::upload
  puppetmaster::self
  $squid_coss_disks = vdb

When running puppet it complains about get_var not being a function:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Unknown function get_var at /etc/puppet/manifests/squid.pp:16 on node i-0000034b.pmtpa.wmflabs

The relevant line is:

    # FIXME: Hack for arrays in LDAP - you suck puppet
    $squid_coss_disks = split(get_var('squid_coss_disks'), ',')

Instance runs Lucid and puppet 2.7.7
Comment 1 Antoine "hashar" Musso (WMF) 2012-07-20 16:30:05 UTC
The doc at http://projects.puppetlabs.com/projects/puppet/wiki/LDAP_Nodes says we must add an extension to puppet parser, maybe it is missing when using puppetmaster::self.

By default the puppetVar LDAP attribute does not support arrays. In order to support an array with puppetVar you must add these two functions to your puppetmaster.

/usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/get_var.rb:

# Evaluate the value of a variable that might have been defined globally.
module Puppet::Parser::Functions
  newfunction(:get_var, :type => :rvalue) do |args|
    var = args[0]
    global_var = lookupvar(var)
    if global_var != "" and global_var != nil
      case global_var
        when "true"
        return true
        when "false"
        return false
        else
        return global_var
      end
    end
    if args.length > 1
      return args[1]
    end
    return ""
  end
end
/usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/split.rb:

# Split a string variable into an array using the specified split
# character.
#
# Usage:
#
#   $string    = 'value1,value2'
#   $array_var = split($string, ',')
#
# $array_var holds the result ['value1', 'value2']
#
module Puppet::Parser::Functions
  newfunction(:split, :type => :rvalue) do |args|
    return args[0].split(args[1])
  end
end
Comment 2 Antoine "hashar" Musso (WMF) 2013-02-04 15:05:36 UTC
beta is no more using puppet manifest for the upload cache
Comment 3 Gerrit Notification Bot 2013-10-09 09:30:08 UTC
Change 88698 had a related patch set uploaded by Ori.livneh:
Remove unused (and broken) labs config from squid manifest

https://gerrit.wikimedia.org/r/88698

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links