cfengine / design-center

CFEngine community-contributed content
http://cfengine.com/
Other
80 stars 67 forks source link

Repository::apt::Maintain - manage /etc/apt/sources.list #416

Open keyurkapasi opened 10 years ago

keyurkapasi commented 10 years ago

Using the sketch for sources.list file, how we can provide params for multiple lines as it doesn't work even if we give separate params configuration for all the repository entry. We have to use sources.list.d/file1... file2..file3... for each repository urls.

I am newbie for sketches but have worked in cfengine 3.4.1.

Could you please help me to us /etc/apt/sources.list having multiple repositories in the same file using Repository::apt::Maintain sketches. ?

tzz commented 10 years ago

Hi @keyurkapasi

Could you post an example of the desired end result, whether it's one file or multiple sources.lists? I can try to prepare a set of JSON parameters that do what you need and show the intended usage. Thanks!

keyurkapasi commented 10 years ago

We have our own repository as mentioned below which I need in the file /etc/apt/sources.list file.

deb http://url_of_repo/debian-security squeeze/updates main contrib non-free deb-src http://url_of_repo/debian-security squeeze/updates main contrib non-free deb http://url_of_repo/debian squeeze-updates main contrib non-free deb-src http://url_of_repo/debian squeeze-updates main contrib non-free deb http://url_of_repo/debian squeeze main contrib non-free deb-src http://url_of_repo/debian squeeze main contrib non-free deb http://url_of_repo/debian-backports squeeze-backports main contrib non-free deb-src http://url_of_repo/debian-backports squeeze-backports main contrib non-free deb http://url_of_repo/brodos squeeze_i386/ deb http://url_of_repo/brodos squeeze_amd64/

Could you please help me configured the same.

tzz commented 10 years ago

Thanks! Everyone is on vacation this week and next but we'll try to give you a solution as soon as we're back.

keyurkapasi commented 10 years ago

Hi,

Any luck on the same ?

tzz commented 10 years ago

Sorry, we're all ridiculously busy working on the CFEngine 3.6.0 release.

If you want to maintain the main sources.list, here's an example to cover the first 4 lines of your list:

[
    {
        "Repository::apt::Maintain":
        {
            url: "http://url_of_repo/debian-security",
            distribution: "squeeze/updates",
            components: [ "main", "contrib", "non-free" ],
            types: ["deb", "deb-src"],
        },
    },
    {
        "Repository::apt::Maintain":
        {
            url: "http://url_of_repo/debian",
            distribution: "squeeze-updates",
            components: [ "main", "contrib", "non-free" ],
            types: ["deb", "deb-src"],
        },
    },
]

Add wipe: true to the first one if you want only your lines to exist, but that will make the file get rewritten every time (wipe for first line, then add every line, saving the file each time). With wipe:true you're better off using separate files for each repo, which you can do by adding the file: /a/b/c parameter. Note also that by having separate activations you can control which machines get which activations (by specifying the activated context at the DC level).

In a future version we'll try to support wipe:true better for the main sources list by passing all the repo parameters as one big list instead of separate activations.

keyurkapasi commented 10 years ago

Thanks for your response !!

Well we have few more repositories (4-5) hence the code would be bigger using each. Wanted some solution which can help me to generate only one file having all repositories in /etc/apt/sources.list instead of using sources.list.d/files...

Check if you could find something like that whenever your convenience... :)

nickanderson commented 10 years ago

I believe this could be done result with tags and variables matching hotness in 3.6.

I want to do it, but bandwidth.

keyurkapasi commented 10 years ago

Any luck on the solution ?

rehan-dev commented 10 years ago

how to add 4 to 9 repository urls in one custom github repository with custom name?