adding repositories to sources.list

176 views
Skip to first unread message

Maxym Pendyshchuk

unread,
Dec 18, 2012, 1:03:48 PM12/18/12
to puppet...@googlegroups.com
Dear puppet community!

I need to add some repositories to sources.list to be able to install sun jdk:

deb-src http://security.debian.org/ lenny/updates main non-free
deb http://security.debian.org/ lenny/updates main non-free
deb-src http://mirrors.kernel.org/debian/ lenny main non-free
deb http://mirrors.kernel.org/debian/ lenny main non-free

I was looking for the best approach for it and decided to try puppetlabs/apt module. Eventually I came out with the following script:

class repositories {
    include apt

    apt::source { 'sun_java':
        location => "http://security.debian.org/",
        release => "squeeze/update",
        repos => "main non-free",
        include_src => true,
    }

    apt::source { 'sun_java2':
        location => "http://mirrors.kernel.org/debian/",
        repos => "main non-free",
        include_src => true,
    }

    package { 'sun_java':
        ensure => installed,
        require => [ Apt::Source['sun_java'], Apt::Source['sun_java2'] ],
    }
}
include repositories


the questions are:
1) how can I added all repositories using one apt::source?
2) I had to write specific release ("squeeze/update").. Is here a way to tell just updates and apt module will generate ${os_version}/update release? (it depends on Debian version, can be lenny/updates...)
3) seems that after adding new repositories puppet tries to install package sun-java... I do not know why, but I get the following error
: "Unable to locate package sun-java"..  why it happens? should I just ignore it, or there is a way to control?
4) any other improvements (best practices?) can you suggest?

windowsrefund

unread,
Dec 18, 2012, 3:41:14 PM12/18/12
to puppet...@googlegroups.com
Generally speaking, you should be managing files in the sources.list.d directory instead of managing lines in a single file.

also (generally speaking), you can

 apt::source {
   foo:
    ensure => present;
  bar:
    ensure => absent;
}

The "style guide" frowns upon this syntax but it is far superior due to the manifest's reduced size and cleaner organization.

Maxym Pendyshchuk

unread,
Dec 18, 2012, 4:13:10 PM12/18/12
to puppet...@googlegroups.com
thanks for reply and another way to write it. And yes, in result I get two files in sources.list.d directory. Is here any way to make it 1? I tried something like:

apt::source {
  foo:
    location => [ 'first_location', 'second_location' ]
    ...
}

but it does not work... I know that in my case it actually won't work because I have 2 different releases (squeeze/update and squeeze), but in general? Maybe everything I can do is just following your advice about writing style...
Reply all
Reply to author
Forward
0 new messages