sous-chefs / apt

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

Run 'apt-cache gencaches' after adding key? #192

Closed lamont-granquist closed 7 years ago

lamont-granquist commented 8 years ago

setup is that i had /etc/apt/soures.list.d/mono.list created, and added a key to it.

the first run it actually adds the new key via apt-key adv but explodes with "package cannot be authenticated!" error:

         * apt_repository[mono] action add
           * execute[install-key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF] action run
             - execute apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
           * ruby_block[validate-key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF] action run (skipped due to not_if)
           * file[/var/lib/apt/periodic/update-success-stamp] action nothing (skipped due to action :nothing)
           * execute[apt-cache gencaches] action nothing (skipped due to action :nothing)
           * execute[apt-get update] action nothing (skipped due to action :nothing)
           * file[/etc/apt/sources.list.d/mono.list] action create (up to date)

         * apt_update[grrr] action periodic (up to date)
         * apt_package[git, inotify-tools, librsvg2-bin, libxml2-dev, libxslt1-dev, lua5.1, liblua5.1-0-dev, luarocks, mono-complete, mono-devel, pkg-config, python, python-dev, python-pip, python-virtualenv, texlive-fonts-recommended, texlive-latex-base, texlive-latex-extra, texlive-latex-recommended, librsvg2-bin, unzip, wget, zip, zsh, zlib1g-dev] action upgrade

           ================================================================================
           Error executing action `upgrade` on resource 'apt_package[git, inotify-tools, librsvg2-bin, libxml2-dev, libxslt1-dev, lua5.1, liblua5.1-0-dev, luarocks, mono-complete, mono-devel, pkg-config, python, python-dev, python-pip, python-virtualenv, texlive-fonts-recommended, texlive-latex-base, texlive-latex-extra, texlive-latex-recommended, librsvg2-bin, unzip, wget, zip, zsh, zlib1g-dev]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '100'
           ---- Begin output of apt-get -q -y install mono-complete=4.2.2.30-0xamarin2 mono-devel=4.2.2.30-0xamarin2 ----
[....]
           WARNING: The following packages cannot be authenticated!
             mono-complete libmono-c5-1.1-cil libmono-cairo4.0-cil
[...]

then i nuked the mono.list file thinking "shitty code, doesn't add the key if the sources file exists" (which i could have seen was the incorrect conclusion to jump to if i'd read the output closer, but its still before noon for me). but then it works:

         * apt_repository[mono] action add
           * execute[install-key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF] action run (skipped due to not_if)
           * ruby_block[validate-key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF] action run (skipped due to not_if)
           * file[/var/lib/apt/periodic/update-success-stamp] action nothing (skipped due to action :nothing)
           * execute[apt-cache gencaches] action nothing (skipped due to action :nothing)
           * execute[apt-get update] action nothing (skipped due to action :nothing)
           * file[/etc/apt/sources.list.d/mono.list] action create
             - create new file /etc/apt/sources.list.d/mono.list
             - update content in file /etc/apt/sources.list.d/mono.list from none to efc271
             (diff output suppressed by config)
             - change mode from '' to '0644'
             - change owner from '' to 'root'
             - change group from '' to 'root'
           * file[/var/lib/apt/periodic/update-success-stamp] action delete
             - delete file /var/lib/apt/periodic/update-success-stamp
           * execute[apt-get update] action run
             - execute apt-get update -o Dir::Etc::sourcelist='sources.list.d/mono.list' -o Dir::Etc::sourceparts='-' -o APT::Get::List-Cleanup='0'
           * execute[apt-cache gencaches] action run
             - execute apt-cache gencaches

         * apt_update[grrr] action periodic (up to date)
         * apt_package[git, inotify-tools, librsvg2-bin, libxml2-dev, libxslt1-dev, lua5.1, liblua5.1-0-dev, luarocks, mono-complete, mono-devel, pkg-config, python, python-dev, python-pip, python-virtualenv, texlive-fonts-recommended, texlive-latex-base, texlive-latex-extra, texlive-latex-recommended, librsvg2-bin, unzip, wget, zip, zsh, zlib1g-dev] action upgrade
           - upgrade package mono-complete from 3.2.8+dfsg-4ubuntu1.1 to 4.2.2.30-0xamarin2
           - upgrade package mono-devel from 3.2.8+dfsg-4ubuntu1.1 to 4.2.2.30-0xamarin2

it skips adding the keys, the mono.list didn't change, i just nuked it before running it again. i'm speculating that apt-cache gencaches need to be run or something.