vendredi 30 septembre 2016

Chef if statement in recipe

I am trying to chef if the ubuntu platform is 14.04 or 16.04 and run the template based on that, but I am receiving errors.

Code:

   if node[:'platform_version'] == '14.04'
            template "/etc/apt/sources.list" do
                source "sources.list.erb"
                mode '0644'
                owner 'root'
                group 'root'
            end
    elseif node[:'platform_version'] == '16.04'
            template "/etc/apt/sources.list" do
                source "apt-sources.list.erb"
                mode '0644'
                owner 'root'
                group 'root'
            end
    end

Output:

[2016-09-30T10:52:55+02:00] WARN: Chef::Provider::AptRepository already exists!  Cannot create deprecation class for LWRP provider apt_repository from cookbook apt
[2016-09-30T10:52:55+02:00] WARN: AptRepository already exists!  Deprecation class overwrites Custom resource apt_repository from cookbook apt
Converging 0 resources

Aucun commentaire:

Enregistrer un commentaire