From 9c317eba10013eb2ea27ec405e1aae691fee7cb0 Mon Sep 17 00:00:00 2001 From: Bram Vogelaar Date: Wed, 13 Jan 2021 21:05:36 +0100 Subject: [PATCH] switching fixtures to git checkout, and making examples more verbose --- .fixtures.yml | 10 +++++----- example/init.pp | 7 +++++-- manifests/repo.pp | 10 +++++++--- spec/acceptance/standard_spec.rb | 6 +++++- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 05127f3..4d4db48 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,8 +1,8 @@ fixtures: - forge_modules: - stdlib: puppetlabs/stdlib - apt: puppetlabs/apt - yum: puppet/yum + repositories: + apt: "https://github.com/puppetlabs/puppetlabs-apt.git" + stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" + yum: "https://github.com/voxpupuli/puppet-yum.git" yumrepo_core: - repo: puppetlabs/yumrepo_core + repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" puppet_version: ">= 6.0.0" diff --git a/example/init.pp b/example/init.pp index ed5cde0..90cb048 100644 --- a/example/init.pp +++ b/example/init.pp @@ -1,2 +1,5 @@ -class { 'hashi_stack::repo': } --> package { 'packer': ensure => installed } +include hashi_stack::repo +package { 'packer': + ensure => installed, + require => Class['Hashi_stack::Repo'], +} diff --git a/manifests/repo.pp b/manifests/repo.pp index 59c0850..8b4d3f2 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -2,11 +2,15 @@ # # @summary Set up the package repository for the HashiCorp Stack components # -# @example +# @example Inclusion using defaults # include hashi_stack::repo # -# @example -# class { 'hashi_stack::repo': } -> package { 'packer': ensure => installed } +# @example Include repo and install packer as package +# include hashi_stack::repo +# package { 'packer': +# ensure => installed, +# require => Class['Hashi_stack::Repo'], +# } # # @param priority A numeric priority for the repo, passed to the package management system # @param proxy The URL of a HTTP proxy to use for package downloads (YUM only) diff --git a/spec/acceptance/standard_spec.rb b/spec/acceptance/standard_spec.rb index 2174044..a21679d 100644 --- a/spec/acceptance/standard_spec.rb +++ b/spec/acceptance/standard_spec.rb @@ -6,7 +6,11 @@ describe 'hashi_stack::repo class' do # Using puppet_apply as a helper it 'should work with no errors based on the example' do pp = <<-EOS - class { 'hashi_stack::repo': } -> package { 'packer': ensure => installed } + include hashi_stack::repo + package { 'packer': + ensure => installed, + require => Class['Hashi_stack::Repo'], + } EOS # Run it twice and test for idempotency