0

I am installing Java 8 in a Vagrant hashicorp/precise32 machine using Puppet spantree/java8 module. While installing I am getting below exception:

==> default: Notice: /Stage[main]/Java8/File[/tmp/java.preseed]/ensure: defined content as '{md5}1b89c67b59fa03a9210a7b22a6b51b92'
==> default: Notice: /Stage[main]/Apache/Package[apache2]/ensure: ensure changed 'purged' to 'present'
==> default: Notice: /Stage[main]/Java8/Apt::Ppa[ppa:webupd8team/java]/Exec[add-apt-repository-ppa:webupd8team/java]/returns: executed successfully
==> default: Notice: /Stage[main]/Java8/File[/etc/profile.d/set_java_home.sh]: Dependency Package[oracle-java8-installer] has failures: true
==> default: Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install oracle-java8-installer' returned 100: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: E: Unable to locate package oracle-java8-installer
==> default: Error: /Stage[main]/Java8/Package[oracle-java8-installer]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install oracle-java8-installer' returned 100: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: E: Unable to locate package oracle-java8-installer
==> default: Warning: /Stage[main]/Java8/File[/etc/profile.d/set_java_home.sh]: Skipping because of failed dependencies

I predict something wrong in line no. - 48 in file init.pp:

  ubuntu: {
      include apt

      apt::ppa { 'ppa:webupd8team/java': }

      package { 'oracle-java8-installer':
        responsefile => '/tmp/java.preseed',
        require      => [
          Apt::Ppa['ppa:webupd8team/java'],
          File['/tmp/java.preseed']
        ],
      }

Any idea how can I fix it?

P.S: I am using librarian-puppet to download the spantree/java8 module from Puppet forge.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108
  • Looks like you're module is not installed and puppet can not find it. It may seem trivial, but have you tried installing it with `puppet module install spantree-java8` ? – Guillaume Fache Sep 14 '15 at 15:24
  • I can see `/Stage[main]/Java8/Apt::Ppa[ppa:webupd8team/java]/Exec[add-apt-repository-ppa:webupd8team/java]/returns: executed successfully` at time of Vagrant up – Arpit Aggarwal Sep 14 '15 at 15:31
  • It is the `oracle-java8-installer`package that is not found, and maybe not installed. Is it in your modules folder ? – Guillaume Fache Sep 14 '15 at 15:37
  • Isn't the same as with your other install ? did you install the module dependencies ? – Frederic Henri Sep 14 '15 at 15:38
  • @FredericHenri: yes it's dependencies are installed by librarian-puppet. – Arpit Aggarwal Sep 14 '15 at 15:40
  • @GuillaumeFache: I know `oracle-java8-installer` is not installed and the same I can install with `sudo apt-get install oracle-java8-installer`, but I want to leverage Puppet module here. – Arpit Aggarwal Sep 14 '15 at 15:42
  • @Arpit, to me it looks the repo is not correctly added, boot the vm and check `/etc/apt/sources.list.d` that it has been correctly added, if not try to run the command and see that you do not need to add a gpg key prior to that – Frederic Henri Sep 14 '15 at 15:58
  • Just another thing, seems the module requires puppet greater than 3.2 but on hashicorp/precise32, the version of puppet is 2.7.x so make sure you update puppet before running the module install – Frederic Henri Sep 14 '15 at 19:53
  • @FredericHenri: Puppet version is : 3.8.2, but I can't find `sources.list.d` inside directory `/etc/apt/` in my guest machine. – Arpit Aggarwal Sep 17 '15 at 13:55

1 Answers1

1

Was finally able to pass through the error by making sure apt-get update runs after the the new ppa is added - this was my change in java8/manifests/init.pp :

ubuntu: {
  include apt

  apt::ppa { 'ppa:webupd8team/java': }

  exec { 'apt-update':
      command => "/usr/bin/apt-get update",
      require      => [
        Apt::Ppa['ppa:webupd8team/java']
      ],
  }

  package { 'oracle-java8-installer':
    responsefile => '/tmp/java.preseed',
    require      => [
      Exec['apt-update'],
      File['/tmp/java.preseed']
    ],
  }
}
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139