Ask Your Question
0

Invalid resource type

asked 2014-11-07 06:44:13 -0500

Chutki gravatar image

Hi,

I want to create file a and b under /etc/modules/dummy. I have written below code

  class dummy::sys_fil {
   define dummy::sys_fil() {
    file {$filename:
    ensure => 'file',
    path => "/etc/modules/dummy"
    }
    }
    }


class dummy::parfil {
$filename = ['a','b']
dummy::sys_fil{$filename:}
}

when I run I got "Invalid resource type dummy::sys_fil at /etc/modules/dummy/parfil.pp:3 on node

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-11-07 07:31:29 -0500

updated 2014-11-13 10:07:50 -0500

Your code have several errors.

First, the defined type shouldn't be inside a class, and you also need a parameter for it. Moreover, the file path should include the file name. The following should work:

define dummy::sys_fil(
  $filename = $title
) {
  file { $filename:
    ensure => 'file',
    path    => "/etc/modules/dummy/${filename}"
  }
}

...

class dummy::parfil {
  $filename = ['a','b']
  dummy::sys_fil{$filename:}
}
edit flag offensive delete link more

Comments

Hi Emyl, Still I am getting invalid resource type error for the same manifests.

Chutki gravatar imageChutki ( 2014-11-09 22:41:04 -0500 )edit

I am getting error in "dummy::sys_fil{$filename:}" Syntax error at '}'; expected '}' at etc/modules/dummy/parfil.pp:3

Chutki gravatar imageChutki ( 2014-11-11 04:41:11 -0500 )edit

Sorry I've modified my answer, please retry

Emyl gravatar imageEmyl ( 2014-11-13 10:08:42 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-11-07 06:44:13 -0500

Seen: 2,113 times

Last updated: Nov 13 '14