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

  • SEARCH
  • Home
  • 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 8935125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:55:33+00:00 2026-06-15T09:55:33+00:00

I have a module core and a class core::logrotate defined in core/manifests/logrotate.pp . class

  • 0

I have a module core and a class core::logrotate defined in core/manifests/logrotate.pp.

class core::logrotate {
#...some stuff here
#
  define confd ($ensure = "present" , $log_name = "dummy" ) {
    if ( $ensure == present )
    {
        file {
          "/etc/logrotate.d/$log_name":
            ensure => present,
            source => filelookup("core/${log_name}.logrotate"),
        }
    } else {
        file {
          "/etc/logrotate.d/$log_name":
           ensure => absent,
        }
    }
  }  
}

calling this function inside of templates.pp as

core::logrotate::confd { "mkill": log_name => mkill }

This fails with the error

Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type core::logrotate::confd

If the puppet master version is 2.6.x then this fails, to make it work there used to be a import “*” in the init.pp of the module. Now removed this as moving to puppet 2.7.20.

The code pasted here works in 2.7 but fails in 2.6. Any idea why? how can I make it work for both 2.6 and 2.7?

  • 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-15T09:55:35+00:00Added an answer on June 15, 2026 at 9:55 am

    You should take the define outside of the class, see the style guide: http://docs.puppetlabs.com/guides/style_guide.html#classes

    Also, I think that you might be using modules wrong, it would be much more logical to have a ‘logrotate’ module on its own.

    So; in modulepath/logrotate/manifests/confd.pp you’d put this:

    define logrotate::confd ($ensure = "present" , $log_name = "dummy" ) {
      if ( $ensure == present )
      {
        file {
          "/etc/logrotate.d/$log_name":
            ensure => present,
            source => filelookup("core/${log_name}.logrotate"),
        }
      } else {
        file {
          "/etc/logrotate.d/$log_name":
           ensure => absent,
        }
      }
    }
    

    That should make it work properly.

    Greetings,
    Ger

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a module called user_searches. It performs some searches that aren't core to
I have a core module with a class that contains: @Autowired private BaseDao dao;
If you have: module A class B end end You can find B and
I have a module Namespace/Search, which was installed when I got here. I took
I am creating a custom module in magento.I have created block class and phtml
I have a problem using Gin. Here is a simple example. @GinModules(AppModule.class) public interface
Problem: to find the Python module execute_manager in the class django.core.management. The question is
I have a Preference class (module) that's used across several different apps. Basically it's
#ifndef CLASS_VEHICLE_ #define CLASS_VEHICLE_ #include ns3/ptr.h #include ns3/object.h #include ns3/vector.h #include ns3/core-module.h #include ns3/network-module.h
I have a module which does property injection for some particular type such as

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.