Skip to content

Commit

Permalink
Merge pull request #8 from jordiprats/master
Browse files Browse the repository at this point in the history
docs + group fact
  • Loading branch information
jordiprats authored Aug 14, 2017
2 parents d822ac9 + eabacd1 commit 2d2bac5
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ matrix:
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="ubuntu16-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="debian8-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.1.10

* added **eypconf_group** fact

## 0.1.9

* removed bool2httpd function
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# eyplib

![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)

#### Table of Contents

1. [Overview](#overview)
Expand All @@ -20,7 +18,7 @@ Standard library of resources for Puppet modules.

## Module Description

Contains common functions for eyp modules
Contains common functions for eyp modules and node classification facts

## Setup

Expand All @@ -36,7 +34,7 @@ Requires pluginsync enabled

## Usage

Just add a dependency on your metadata.json file, for example:
Just add a dependency on your **metadata.json** file, for example:

```json
"dependencies": [
Expand All @@ -56,6 +54,14 @@ in ERB files you can call this module's functions using:

### functions

#### bool2boolstr

Transform a boolean to a string (**true** or **false**). Other values through.

#### bool2number

Transform a boolean (it can also be a string) to **0** or **1**. Other values through.

#### bool2onoff

Transform a boolean (it can also be a string) to **On** or **Off**. Other values through.
Expand All @@ -64,9 +70,10 @@ Transform a boolean (it can also be a string) to **On** or **Off**. Other values

Transform a boolean (it can also be a string) to **yes** or **no**. Other values through.

#### bool2httpd
#### bool2yn

Transform a boolean (it can also be a string) to **y** or **n**. Other values through.

Same as **bool2onoff**, transform a boolean (it can also be a string) to **On** or **Off**. Other values through.

## Development

Expand Down
25 changes: 25 additions & 0 deletions lib/facter/eypconf_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if File.exists?('/opt/eypconf/id/group.sh') then
nodetype = Facter::Util::Resolution.exec('bash /opt/eypconf/id/group.sh').to_s
else
nodetype = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/group ]; then cat /opt/eypconf/id/type | paste -sd,; fi\'')
end

unless nodetype.nil? or nodetype.empty?
Facter.add('eypconf_group') do
setcode do
nodetype
end
end

Facter.add('eypconf_group_uppercase') do
setcode do
nodetype.upcase
end
end

Facter.add('eypconf_group_lowercase') do
setcode do
nodetype.downcase
end
end
end
4 changes: 1 addition & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# === eyplib documentation
#
class eyplib inherits eyplib::params{

class eyplib {
# nothing to do here

}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-eyplib",
"version": "0.1.9",
"version": "0.1.10",
"author": "eyp",
"summary": "Utility functions for puppet modules",
"license": "Apache-2.0",
Expand Down
14 changes: 14 additions & 0 deletions spec/acceptance/nodesets/debian8-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HOSTS:
debian-8:
default_apply_opts:
order: random
strict_variables:
platform: debian-8-amd64
hypervisor : docker
image: debian:8
docker_preserve_image: true
docker_image_commands:
- 'apt-get install libssl-dev gcc make tar wget openjdk-7-jdk -y'
CONFIG:
type: foss
log_level: debug
15 changes: 15 additions & 0 deletions spec/acceptance/nodesets/ubuntu16-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
ubuntu-1604-x64:
default_apply_opts:
order: random
strict_variables:
platform: ubuntu-16.04-amd64
hypervisor : docker
image: ubuntu:16.04
docker_cmd: '["/sbin/init"]'
docker_preserve_image: true
docker_image_commands:
- 'apt-get install net-tools gcc make tar wget -y'
CONFIG:
type: foss
log_level: debug

0 comments on commit 2d2bac5

Please sign in to comment.