sous-chefs / apt

Development repository for the apt cookbook
https://supermarket.chef.io/cookbooks/apt
Apache License 2.0
201 stars 266 forks source link

ubuntu creates invalid apt #171

Closed spuder closed 8 years ago

spuder commented 8 years ago

The following recipe creates the following apt repository

apt_repository 'sbt' do
  uri 'https://dl.bintray.com/sbt/debian /'
  key '642AC823'
  keyserver 'keyserver.ubuntu.com'
  action :add
end
deb     "https://dl.bintray.com/sbt/debian /"

However this is not a valid repository because of the double quotes.

root@default-ubuntu-1404:~# apt-get update
E: Malformed line 1 in source list /etc/apt/sources.list.d/sbt.list (dist)
E: The list of sources could not be read.

Manually editing the /etc/sources.d/apt/sbt.list to look like the following fixes the problem.

deb     https://dl.bintray.com/sbt/debian /

How can I make the cookbook not add the double quotes?

Additional information

http://www.scala-sbt.org/0.13/tutorial/Installing-sbt-on-Linux.html

spuder commented 8 years ago

:flushed: This works

apt_repository 'sbt' do
  uri 'https://dl.bintray.com/sbt/debian'
  key '642AC823'
  components ['/']
  keyserver 'keyserver.ubuntu.com'
  action :add
end
nabarunchatterjee commented 8 years ago

But how to make something like this work

apt_repository "elasticsearch-#{esversion}" do
  uri "http://packages.elastic.co/elasticsearch/#{esversion}/debian"
  components ['stable','main']
  key 'https://packages.elastic.co/GPG-KEY-elasticsearch'
  action :add
end

I still get quotes around the uri.

Moreover I get 'trusty'(without quotes) after the uri.

The desired result is deb http://packages.elastic.co/elasticsearch/1.7/debian stable main

what I get is deb "http://packages.elastic.co/elasticsearch/1.7/debian" trusty stable main

rmoriz commented 8 years ago

@nabarunchatterjee stable is not a component. you don't have a distribution specified => current distribution name. Quotes are irrelevant.

Also: man sources.list, read https://github.com/chef-cookbooks/apt#readme

ericgoedtel commented 7 years ago

Quotes definitely matter because removing them fixes the problem for me just as it fixed it for the original reporter.

ericgoedtel commented 7 years ago

@nabarunchatterjee you should check out the official Elasticsearch cookbook. It installs the repo like this:

apt_repository 'elastic-5.x' do
  uri 'https://artifacts.elastic.co/packages/5.x/apt'
  components ['main']
  distribution 'stable'
  action :nothing # :create, :delete
end

So what @rmoriz said is correct: stable is not component. its a distribution.