while installing apache in puppet5 getting below error

100 views
Skip to first unread message

vinodkumar mannem

unread,
Nov 12, 2018, 1:18:18 PM11/12/18
to Puppet Users
I have new to puppet.I am trying to install appache using puppet code but getting below error.
please help me how to resolve this issue.

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: A substring operation does not accept a String as a character index. Expected an Integer (file: /etc/puppetlabs/code/environments/production/modules/mediawiki/manifests/init.pp, line: 62, column: 25) on node puppet-slave.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

this is is my init.pp file code
---------------------------------------------------------

class mediawiki {
$phpmysql = $osfamily?{
  'RedHat' => 'php-mysql',
  'Debian' => 'php5-mysql',
  'Default' => 'php-mysql',
}
package{$phpmysql:
  ensure => 'present',
}
if $osfamily == 'RedHat'{
   package{'php-xml':
   ensure => 'present',
  }
 }
class {'::apache':
   docroot => '/var/www/html',
   mpm_module => 'prefork',
  subscribe  => package[$phpmysql],
}
class {'::apache::mod::php':}
}


--this is my site.pp file 
---------------------------------------------------------------------
node 'puppet-slave'{
  class{'linux':}
  class{'mediawiki':}
 }
node 'puppet-slave1'{
  class{'linux':}
  class{'mediawiki':}
 }
class linux{
$httpdservice = $osfamily?{
  'RedHat'  => 'httpd',
  'Debian'  => 'apache',
  'Default' => 'httpd',
}
$admintools=['git','nano']
  package{
   $admintools:
   ensure => 'present',
 }

file{'/info.txt':
      ensure => 'present',
      content=> 'this is created by puppet',
 }
}



please somebody help me what could be the problem .how to resolve.


Henrik Lindberg

unread,
Nov 12, 2018, 1:39:04 PM11/12/18
to puppet...@googlegroups.com
The error message and the source does not line up - it says line 62, and
there are far fewer lines here.

The error is in package[$phpmysql], where "package" is actually a
string, and so is $phpmysql - you probably wanted "Package[$phpmysql]"
since an upper case bare word is a reference to a data type.

- henrik

> }
> class {'::apache::mod::php':}
> }
>
>
> --this is my site.pp file
> ---------------------------------------------------------------------
> node 'puppet-slave'{
>   class{'linux':}
>   class{'mediawiki':}
>  }
> node 'puppet-slave1'{
>   class{'linux':}
>   class{'mediawiki':}
>  }
> class linux{
> $httpdservice = $osfamily?{
>   'RedHat'  => 'httpd',
>   'Debian'  => 'apache',
>   'Default' => 'httpd',
> }
> $admintools=['git','nano']
>   package{
>    $admintools:
>    ensure => 'present',
>  }
>
> file{'/info.txt':
>       ensure => 'present',
>       content=> 'this is created by puppet',
>  }
> }
>
>
>
> please somebody help me what could be the problem .how to resolve.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/ab4347f4-f460-4fd9-aedd-d14803f322ec%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/ab4347f4-f460-4fd9-aedd-d14803f322ec%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages