Domain Driven Architecture

September 27, 2016 By: Thomas Jakob

Inspecting Pallet Sessions

Analyzing an executed pallet session

Have you ever found yourself with a pallet session after an pallet.api/left and asked yourself...

  • What actually happened on my nodes?


  • What informations are contained in this session?

Here is a short overview of some tools to inspect the session. We used only one node (localhost) and did run the configure phase to show some examples. Feel free to analyze your own sessions!

Using tools from pallet.repl:

The most simple way is using pallet.repl/session-summary:

(pallet.repl/session-summary (pallet.api/lift ...))
PHASES: configure
GROUPS: local
  PHASE configure:
    GROUP local:
      NODE OK

This shows you a small overview about phases, groups, nodes and "OK" or "ERROR" to indicate if there were any problems. This is good to see again which nodes have been touched. To see more details about the executed actions there is pallet.repl/explain-session:

(pallet.repl/explain-session (pallet.api/lift ...))
PHASES: configure
GROUPS: local
  PHASE configure:
    GROUP local:
          CONTEXT: [someinstalls: owncloud]:
          | #!/usr/bin/env bash
          | set -h
          | echo '[someinstalls: owncloud]: Package source...';
          | {
          | echo '[someinstalls: owncloud]: remote-file /etc/apt/sources.list.d/owncloud-client.list...';
          | {
          | {
          | # -- START pallet implementation function
          | verify_md5() {
//*** snip ***//

Even simple lifts create a lot of output this way and it's not really human-readable. This shows you every script and result that is executed on a node. In our example the first action adds a repository to install an owncloud-client and you see the beginning pallet implementation of the bash script to add the repository.

Using tools from org.domaindrivenarchitecture.pallet.commons.session-tools:

You can find the sources for the tools in our dda-pallet-commons repository on GitHub. Our goal was to provide easy tools to inspect and archive the actions performed on a node. It might also help you debugging what happened without searching in very very long logfiles.

   "/home/john/session.xml" (session-tools/explain-session-xml (pallet.api/lift ...)

This creates a very simple xml-file from the pallet session map and this is not meant to be viewed. We use an xsl stylesheet transformation to show it in your favorite browser. The result looks like this:

While the look and feel can still be improved it already helps us a lot. To start inspect the session you might:

  • Inspect the performed actions without getting overwhelmed by long scripts and outputs. Just expand whatever you need to see. If you got any errors look for the exit code of the actions.
  • Inspect the session (as a clojure map) itself in the top.

You might also perform a plan on a mock-node to see what would happen by using

   "/home/john/plan.xml" (session-tools/explain-plan-xml a-pallet-plan-fn))

If you want to learn more about these methods have a look at the namespace that contains some mocking tools.

Tags: opensource clojure pallet debugging session

Powered by Cryogen | Free Website Template by Download Website Templates | Impressum