tykeal / puppet-gerrit

Puppet module to manage Gerrit
6 stars 7 forks source link

java_home can not be overruled/set through yaml #13

Closed ltutar closed 8 years ago

ltutar commented 8 years ago

I am managing my own java and set the gerrit::install_java: false in yaml. I get the following error. I am not able to set java_home to /usr/java/default The line gerrit::params::java_home: '/usr/java/default' in yaml is also not working.

Notice: /Stage[main]/Gerrit::Initialize/Exec[gerrit_initialize]/returns: executed successfully
Info: Class[Gerrit::Service]: Scheduling refresh of Service[gerrit]
Error: Could not start Service[gerrit]: Execution of '/sbin/service gerrit start' returned 1: Cannot find a JRE or JDK. Please set JAVA_HOME or
container.javaHome in /opt/gerrit/etc/gerrit.config
to a >=1.7 JRE
Error: /Stage[main]/Gerrit::Service/Service[gerrit]/ensure: change from stopped to running failed: Could not start Service[gerrit]: Execution of '/sbin/service gerrit start' returned 1: Cannot find a JRE or JDK. Please set JAVA_HOME or
container.javaHome in /opt/gerrit/etc/gerrit.config
to a >=1.7 JRE
Notice: /Stage[main]/Gerrit::Service/Service[gerrit]: Triggered 'refresh' from 1 events
Info: Class[Gerrit::Service]: Unscheduling all events on Class[Gerrit::Service]
tykeal commented 8 years ago

Trying to set gerrit::params::java_home in your hiera / class calls isn't going to do anything. The params class doesn't consume anything.

The correct way to override the default is to have something like the following:

gerrit::override_options:
  container:
    javaHome: '/usr/java/default'

Or if calling the gerrit class manually it would be something like:

class { 'gerrit':
  override_options => {
    'container' => {
      'javaHome' => '/usr/java/default',
    },
  }
}
ltutar commented 8 years ago

Thank you. It is working. I have now:

gerrit::override_options:
  container:
    user: 'gerrit'
    javaHome: '/usr/java/default'

without the user line, I get the error

Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Missing title. The title expression resulted in undef at /etc/puppetlabs/code/environments/production/modules/gerrit/manifests/install.pp:161:10 on node jenkinsagent.home
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
tykeal commented 8 years ago

Ah yes, sorry I forgot to include / mention that. The hash merging of puppet doesn't do deep merges without special setup that affects an entire site.

ltutar commented 8 years ago

No problem. I started using your module today and I am also new to gerrit. You may get some questions from me the next days :)

tykeal commented 8 years ago

No worries. I've been supporting Gerrit for almost 3 years now. I wrote this because we at The Linux Foundation support 5+ different Gerrit systems and we needed a decent role / profile designed module and there wasn't one out there.