Puppet - Unable to locate package oracle-java8-installer

时间:2015-09-14 15:19:48

标签: vagrant puppet librarian-puppet

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.

1 个答案:

答案 0 :(得分:1)

最后能够通过确保在添加新ppa后运行apt-get update来传递错误 - 这是我对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']
    ],
  }
}