Git Product home page Git Product logo

puppetlabs-dummy_service's Introduction

A simple dummy service implementation for Puppet. Useful in contexts where you don't want Service resources to do anything, for example when building containers.

Puppet Forge Build Status

Installation

dummy_service is packaged as a Puppet Module, and can be installed from the Forge like so:

puppet module install puppetlabs-dummy_service

You can also include in your Puppetfile if using r10k or librarian-puppet:

mod 'puppetlabs/dummy_service'

Usage

The module adds a new Service provider to Puppet. Although you can specify this on a per-resource basis it's probably more likely that you will use the resource defaults feature of Puppet like so:

Service {
  provider => dummy
}

Alternatively you can use resource collectors. This is useful in situations where a module explictly sets a provider value.

Service <| |> { provider => dummy }

As a useful shortcut you can also just include the included class:

include dummy_service

You may decide to include that in several modules and, for instance, gate it so that services are only clobbered when running under Docker:

if $virtual == 'docker' {
  include dummy_service
}

Demonstration

The module contains a quick example in the examples directory. You can see this in action easily with the puppet Docker images.

This example shows what happens when you try and ensure => running on a service which is not configured:

docker run --rm -it -v $(pwd):/src/dummy_service:ro puppet/puppet-agent-ubuntu apply /src/dummy_service/examples/without_dummy.pp --test --modulepath=/src
Notice: Compiled catalog for 55b183b19b57.local in environment
production in 0.29 seconds
Info: Applying configuration version '1468839204'
Error: Could not find init script for 'openssh'
Error: /Stage[main]/Main/Service[openssh]/ensure: change from stopped to
running failed: Could not find init script for 'openssh'
Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.03 seconds

The following example shows the same resource, but with the dummy service provider specifed as noted above.

docker run --rm -it -v $(pwd):/src/dummy_service:ro puppet/puppet-agent-ubuntu apply /src/dummy_service/examples/with_dummy.pp --test --modulepath=/src
Notice: Compiled catalog for 693fba958896.local in environment
production in 0.30 seconds
Info: Applying configuration version '1468839318'
Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.02 seconds

Thanks

Thanks to @larsks for originally documenting this idea.

Maintainers

This repository is maintained by: Gareth Rushgrove [email protected].

puppetlabs-dummy_service's People

Contributors

garethr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.