When Puppet fails to add new APT software repositories

What a day! Day in console, day with Debian, day with Puppet! The day when you get error from Puppet and search for solution just because you miss error or notice message.

What I do: I add few Debian APT repositories with Puppet for provisioning and then install software from those repositories on the same run. Nothing special… but I’m getting an error:

==> default: Error: /Stage[main]/Apt::Update/Exec[apt_update]: Failed to call refresh: /usr/bin/apt-get update returned 100 instead of one of [0]
==> default: Error: /Stage[main]/Apt::Update/Exec[apt_update]: /usr/bin/apt-get update returned 100 instead of one of [0]

Of course, everything fails.

If you search for solution over the Internet – you will find many different suggestions, but most of them go around executing apt-get update and playing around using custom Exec['apt_get_update'] but nothing helped in my situation.

After a short brake and rebooting the host I’ve tried one more time the same unchanged script. Yes, that sounds insane – running same failing script and wait for different result but this time I’ve read every notice and error from Puppet and found next notices:

==> default: Notice: /Stage[main]/Main/Apt::Source[nodesource]/Apt::Setting[list-nodesource]/File[/etc/apt/sources.list.d/nodesource.list]/ensure: created
==> default: Notice: /Stage[main]/Main/Apt::Source[mysql]/Apt::Setting[list-mysql]/File[/etc/apt/sources.list.d/mysql.list]/ensure: created
==> default: Notice: /Stage[main]/Main/Apt::Source[dotdeb]/Apt::Setting[list-dotdeb]/File[/etc/apt/sources.list.d/dotdeb.list]/ensure: created
==> default: Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: The method driver /usr/lib/apt/methods/https could not be found.

That tiny notice I’ve missed is the root of all my problems. The package apt-transport-https was missing. Actually it was added using old Puppet syntax.

Adding: require => Package['apt-transport-https'] to apt::source that uses HTTPS solved the problem. No custom Exec['apt_get_update'] needed, everything works as described in Adding new sources or PPAs.

So, the lesson of the day: read all errors and notices and analyze them, update your Puppet modules and change your code according to changes in Puppet syntax.

Lint PHP files in parallel

One of the quickest and minimal code quality checks in software development is a simple syntax check. In case of PHP we have php -l <path/to/file.php>, nothing smart, nothing fancy.

In case of check automation or continuous integration you even may use Phing task PhpLintTask – runs perfectly and fails build f someone occasionally commits code with syntax errors.

But if you have many files, many CPU cores and fast enough disk – you can lint your PHP files in parallel with PHP Parallel Lint. I’ve tried this tool today and it runs twice faster than standard Phing task using serial approach.

Do you refactor?

Refactoring is a part of our daily routine when we write code, at least it should be even in legacy projects.

One of the goals of refactoring – clean, readable and understandable code.

You can find good example how to start refactoring by reading  Cleaning up Code: Is Refactoring for Aesthetics worth It?

That article partly based on Clean Code and I recommend you to apply Clean Code rules in your project, as I do.

New Oracle VirtualBox release – 5.1

Tool I use, VirtualBox, has a new version released 5.1. If you are new to this tool – Oracle has an announcement Oracle VM VirtualBox 5.1.0 is now available!, but for me it has two most important changes: Improved Performance and Improved Linux integration. I hope VirtualBox will be much faster now.

Release is out there in repository, just type sudo apt-get install virtualbox-5.1 and upgrade if you can. Because I can’t – another tool, Vagrant, that depends on VirtualBox, stops working. Issue Support Virtualbox 5.1 #7411 is already closed, but there is no stable version release with that patch. for now So I’ll wait until Vagrant 1.8.5 released.

A new Skype (Alpha) for Ubuntu…

So, finally after few years(?) Microsoft updated Skype for Linux. But be careful, as much as I see from different sources: A new Skype for Ubuntu… Alpha available now!, Skype Announce Brand New Linux Client, Now In Alpha it’s still in Alpha and incompatible with old Skype for Linux.

So, think twice before upgrade, note from Microsoft:

You will notice that with the Alpha version of Skype for Linux, which uses our next generation calling architecture, you will be able to call your friends and family on the latest versions of Skype on Windows, Mac, iOS and Android, but you won’t be able to make or receive calls to and from the previous versions of Skype for Linux (

Look at the FAQ of Skype for Linux Alpha – you might miss a vital feature or two.

By the way, don’t miss the comments under Microsoft press-release – priceless :)

Will I upgrade? Nope, not until it’s stable or Old good Skype for Linux works on my Ubuntu 16.04.

Real-time dashboards

Real-time dashboards on big LCD screen in the office – I think this is present in every cool team and desired thing of one that don’t have (including me). Lots of information displayed on screen in fancy diagrams and updated in real-time. But does those diagrams have any impact on what you do and how you do? So, before making a decision about creating one in your office read Real-time dashboards considered harmful – it might change your goal.