2

I read in puppet that resources can also be declared using Resource[] syntax in manifest. I wrote below manifest but it is giving error

Error: Could not parse for environment production: Syntax error at 'NO'; expected '}' at /etc/puppet/manifests/no.pp:3 on node pk-docker-01.cs1cloud.internal
Error: Could not parse for environment production: Syntax error at 'NO'; expected '}' at /etc/puppet/manifests/no.pp:3 on node pk-docker-01.cs1cloud.internal


file { '/var/NO/tmp' : ensure => directory,
}
Resource[User] {"NO":

    ensure => present ,
    password => 'admin@123',
}

group { no :
    ensure => present ,
}

Thanks

anonymous
  • 1,920
  • 2
  • 20
  • 30

2 Answers2

0

The documentation you referenced is for Puppet 4.2. You can find the Puppet 3.8 reference here.

The type of declaration you are using is not supported in 3.8. Either way, you should use the standard file{ 'dfsf': } resource declaration since it is compatible with more versions of puppet.

Chris Pitman
  • 12,990
  • 3
  • 41
  • 56
0

I checked the Puppet 3.8 Documentation for resources and don't see abstract resources but that doesn't mean the feature doesn't exist. That being said I also found the following information and example on the Data Resource Type page. It is possible in 3.8 that the resource types need to be quoted strings as in the following example:

# A resource declaration using a resource data type:
File { "/etc/ntp.conf":
  mode  => "0644",
  owner => "root",
  group => "root",
}

# Equivalent to the above:
Resource["file"] { "/etc/ntp.conf":
  mode  => "0644",
  owner => "root",
  group => "root",
}

# A resource default:
File {
  mode  => "0644",
  owner => "root",
  group => "root",
}

So you could try the following with your code and see if it fixes the issue:

file { '/var/NO/tmp' : ensure => directory,
}
Resource["user"] {"NO":

    ensure => present ,
    password => 'admin@123',
}

group { no :
    ensure => present ,
}

My best advice though is to be particularly careful when viewing Puppet documentation. Ensure you are always looking at the version you are running when planning changes to your production environment and not just trying to learn about upcoming features, etc.

I hope this helps!

ccampanale
  • 1,110
  • 1
  • 8
  • 11