Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:44:32+00:00 2026-06-06T22:44:32+00:00

I am trying to understand Puppet parameterized classes. I have a parameterized class defined

  • 0

I am trying to understand Puppet parameterized classes. I have a parameterized class defined this way:

class defaults(
  $no_samba = 'FALSE'
)
{
  if ($no_samba =~ /TRUE/) {
    notify { "will not install samba": } ;
  } else {
    # install samba here
  }

  # More server install tasks here...
}

Furthermore, I define a basenode as follows:

node basenode
{
  class {'defaults':
    no_samba => 'FALSE',
  }
}

and then I instantiate a server:

node myserver1 inherits basenode {
  Class['defaults'] { no_samba => 'TRUE' }
}

However, this does not work. The myserver1 node does not show the notify message indicating that samba will not be installed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:44:33+00:00Added an answer on June 6, 2026 at 10:44 pm

    Here’s my non-typo answer – I think you’re running into http://projects.puppetlabs.com/issues/7890

    Here’s a code sample where I tweaked your code to get the effect you’re looking for, based on the rewritten example in the ticket:

    class defaults(
      $no_samba = 'FALSE'
    )
    {
    
      notify {"no_samba_hack" :
        message => "$no_samba";
      }
    
      if ($no_samba =~ /TRUE/) {
        notify { "will not install samba": }
      } else {
        # install samba here
      }
    
      # More server install tasks here...
    }
    
    class basenode($no_samba="FALSE") {
      class {defaults: no_samba => $no_samba}
    }
    
    node yourserver {
    
      class { 'basenode' : no_samba => 'TRUE'}
    
    }
    

    When I run that with ‘puppet apply sample.pp’ with puppet 2.7.11 on Ubuntu 12.04, I get the following output:

    notice: will not install samba
    notice: /Stage[main]/Defaults/Notify[will not install samba]/message: defined 'message' as 'will not install samba'
    notice: TRUE
    notice: /Stage[main]/Defaults/Notify[no_samba_hack]/message: defined 'message' as 'TRUE'
    notice: Finished catalog run in 0.05 seconds
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to understand how CoffeeScript instance and class variable works I came with this
HI Trying to understand how __radd__ works. I have the code >>> class X(object):
Trying to understand the options for will_paginate's paginate method: :page — REQUIRED, but defaults
Trying to understand Ruby a bit better, I ran into this code surfing the
Trying to understand the math of this code snippet. A token is provided which
Just trying to understand that - I have never used it before. How is
Trying to understand what Sql Profiler means by emitting sp_reset_connection. I have the following,
Trying to understand why this doesn't work. I keep getting the following errors: left
Trying to understand resources in java-land. I believe the following is true: Resources loaded
Trying to understand this binding process of the WPF. See the code at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.