VLT-Website-Heading

Puppet Learning VM quest task not shown as complete

Oct 14, 2020 2:22:30 PM / by Vu Long Tran

If you are working through the Puppet Learning VM (Virtual Machine) and are facing an issue where it is not registering a task that you know you have completed already. Here's my guidance to help you work through the issue.

First off, it is good to know how the quest is identifying that you are completing the tasks, and it is being done so using Serverspec tests. The Puppet team notes that "The quest tool uses a series of Serverspec tests for each quest to track task progress, but the match between a task and test isn't always perfect."

Since it is quite binary in the way it can check, so I would recommend looking at the latest corresponding code in the Puppet Learning VM Quest Guide repository.

As I was working through some quests and it did not pick up initially so I wanted to work out what I did wrong.

Puppet Learning VM quest task not shown as complete

Agent Run quest - Task 4 not registering

Here is an example with the Agent Run quest (quest begin agent_run) where I faced this issue as I working through the tasks. 

puppet-vm-agent-run-not-complete

You can follow the Agent Run steps via the Quest Guide here if you want to refer to it.

Puppet Learning VM agent run

Puppet Learning VM agent runPuppet Learning VM agent run

Puppet Learning VM agent run

You will notice when I run the quest status check (quest status) that I have completed all tasks except for Task 4.

Task not complete

Puzzled, I read through the troubleshooting guide and restarted the virtualbox virtual machine instance for Puppet Learning VM and still faced the same issue.

When I looked into the Serverspec code for the Agent Run quest was checking that was when I realised what might be happening and that is that I was missing a space in my manifest.pp file.

Code to inspect

So if you look at the code carefully you will see that it says it is checking for "\s".

I also looked back at the Quest Guide and can see there is a space in front of 'Hello Puppet', where it says:

notify { ' Hello Puppet!': }

when I had it noted as:

notify {' Hello Puppet!': }

Notice the notify {<space>' Hello Puppet!': }

Code to inspect

Once I fixed that, it was working fine.

Code to inspect

As you can see here when I run the quest status command again.

Code to inspect

So be sure to refer to the Puppet Learning VM ServerSpec code if you do find that you have completed a task and it is not registering in the system.

It is possible that the checker has written the test for a task in a way that is too restrictive and doesn’t correctly capture a valid syntactical variation in your Puppet code or another relevant file. Certain tasks simply check your bash history for an entered command. In some cases, the /root/.bash_history won’t be properly initialized, causing these tests to fail. Exiting the VM and logging in again will fix this issue.

You can refer to the Puppet Learning VM ServerSpec code used  here - https://github.com/puppetlabs/puppet-quest-guide/tree/master/tests

I hope that helps you in your Puppet learning journey!

Topics: puppet, linux

Vu Long Tran

Written by Vu Long Tran

Solutions Engineer APAC. ex-@Forrester consultant. Writing on #cloud #howto guides and #tech tinkering!