16 changes: 10 additions & 6 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
docker: "https://github.com/garethr/garethr-docker.git"
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
symlinks:
grafana: "#{source_dir}"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
docker: "https://github.com/garethr/garethr-docker.git"
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
puppet_version: ">= 6.0.0"
augeas_core:
repo: https://github.com/puppetlabs/puppetlabs-augeas_core.git
puppet_version: ">= 6.0.0"
75 changes: 60 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.

1. Create a separate branch for your change.

1. Run the tests. We only take pull requests with passing tests, and
documentation.
1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org)
runs the tests for us. You can also execute them locally. This is explained
in a later section.

1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we
use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html).
They provide some guidance for new code that might help you before you submit a pull request.

1. Add a test for your change. Only refactoring and documentation
changes require no new tests. If you are adding functionality
or fixing a bug, please add a test.

1. Squash your commits down into logical components. Make sure to rebase
against the current master.
against our current master.

1. Push the branch to your fork and submit a pull request.

Expand All @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet.
If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

export PUPPET_VERSION="~> 4.2.0"
```sh
export PUPPET_VERSION="~> 5.5.6"
```

You can install all needed gems for spec tests into the modules directory by
running:
Expand All @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
check various syntax and style things. You can run these locally with:

bundle exec rake lint
bundle exec rake validate
```sh
bundle exec rake lint
bundle exec rake validate
```

It will also run some [Rubocop](http://batsov.com/rubocop/) tests
against it. You can run those locally ahead of time with:

bundle exec rake rubocop
```sh
bundle exec rake rubocop
```

## Running the unit tests

Expand All @@ -82,15 +93,21 @@ about how best to test your new feature.

To run the linter, the syntax checker and the unit tests:

bundle exec rake test
```sh
bundle exec rake test
```

To run your all the unit tests

bundle exec rake spec SPEC_OPTS='--format documentation'
```sh
bundle exec rake spec
```

To run a specific spec test set the `SPEC` variable:

bundle exec rake spec SPEC=spec/foo_spec.rb
```sh
bundle exec rake spec SPEC=spec/foo_spec.rb
```

## Integration tests

Expand All @@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
simple tests against it after applying the module. You can run this
with:

bundle exec rake acceptance
```sh
bundle exec rake acceptance
```

This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,

BEAKER_set=centos-7-x64 bundle exec rake acceptance
```sh
BEAKER_set=centos-7-x64 bundle exec rake acceptance
```

There are default rake tasks for the various acceptance test modules, e.g.,

bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```sh
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```

If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.

Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
```

You can replace the string `debian9` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* debian8
* debian9
* centos6
* centos7

The easiest way to debug in a docker container is to open a shell:

docker exec -it -u root ${container_id_or_name} bash
```sh
docker exec -it -u root ${container_id_or_name} bash
```

The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
repository.
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '1.9.3'
modulesync_config_version: '2.1.0'
1 change: 1 addition & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ PrePush:
enabled: true
description: 'Run rake targets'
targets:
- 'validate'
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
41 changes: 31 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ sudo: false
dist: trusty
language: ruby
cache: bundler
# related to https://github.com/rubygems/rubygems/issues/2123
before_install:
- 'rm -f Gemfile.lock'
- 'gem update --system'
- 'gem install bundler'
- rm -f Gemfile.lock
script:
- 'bundle exec rake $CHECK'
matrix:
Expand All @@ -21,23 +18,47 @@ matrix:
env: PUPPET_VERSION="~> 5.0" CHECK=test
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 6.0" CHECK=rubocop
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
services: docker
sudo: required
branches:
Expand Down
31 changes: 29 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,30 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v4.5.0](https://github.com/voxpupuli/puppet-grafana/tree/v4.5.0) (2018-07-15)
## [v5.0.0](https://github.com/voxpupuli/puppet-grafana/tree/v5.0.0) (2018-10-06)

[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v4.5.0...v5.0.0)

**Breaking changes:**

- Change default of version parameter to 'installed' [\#126](https://github.com/voxpupuli/puppet-grafana/pull/126) ([baurmatt](https://github.com/baurmatt))

**Implemented enhancements:**

- removing value restriction on grafana\_datasource so any custom plugin can be used [\#136](https://github.com/voxpupuli/puppet-grafana/pull/136) ([lukebigum](https://github.com/lukebigum))
- add --repo option to grafana\_cli plugin install [\#132](https://github.com/voxpupuli/puppet-grafana/pull/132) ([rwuest](https://github.com/rwuest))
- Parametrize provisioning file names [\#128](https://github.com/voxpupuli/puppet-grafana/pull/128) ([kazeborja](https://github.com/kazeborja))

**Closed issues:**

- Version parameter should default to 'installed' [\#125](https://github.com/voxpupuli/puppet-grafana/issues/125)

**Merged pull requests:**

- modulesync 2.1.0 and allow puppet 6.x [\#137](https://github.com/voxpupuli/puppet-grafana/pull/137) ([bastelfreak](https://github.com/bastelfreak))
- allow puppetlabs/stdlib 5.x and puppetlabs/apt 6.x [\#134](https://github.com/voxpupuli/puppet-grafana/pull/134) ([bastelfreak](https://github.com/bastelfreak))

## [v4.5.0](https://github.com/voxpupuli/puppet-grafana/tree/v4.5.0) (2018-07-16)

[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v4.4.1...v4.5.0)

Expand All @@ -13,6 +36,10 @@ These should not affect the functionality of the module.
- Use provisioning backend for dashboards, providers [\#103](https://github.com/voxpupuli/puppet-grafana/issues/103)
- Feature: Add grafana provisioning to this module. [\#120](https://github.com/voxpupuli/puppet-grafana/pull/120) ([drshawnkwang](https://github.com/drshawnkwang))

**Closed issues:**

- Any plan to update module to use the grafana provisioning by yaml files ? [\#122](https://github.com/voxpupuli/puppet-grafana/issues/122)

## [v4.4.1](https://github.com/voxpupuli/puppet-grafana/tree/v4.4.1) (2018-07-04)

[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v4.4.0...v4.4.1)
Expand Down Expand Up @@ -342,4 +369,4 @@ This is the last Release that supports it!
First release on the Puppet Forge


\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 2.6', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
Expand Down Expand Up @@ -54,15 +53,17 @@ group :system_tests do
end
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', '>= 1.1.10', :require => false
gem 'beaker-docker', :require => false
gem 'beaker-puppet', :require => false
gem 'beaker-puppet_install_helper', :require => false
gem 'beaker-module_install_helper', :require => false
gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6'
gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6'
gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6'
gem 'bcrypt_pbkdf', :require => false
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
gem 'puppet-strings', '>= 1.0', :require => false
Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ which is not part of grafana's syntax. This option will be extracted
from the hash, and used to "source" a directory of dashboards. See
**Advanced Usage** for details.

#### `provisioning_dashboards_file`

A String that is used as the target file name for the dashabords
provisioning file. This way the module can be used to generate placeholder
files so password can be sepecified in a different iteration, avoiding them
to be put in the module code.

#### `provisioning_datasources_file`

A String that is used as the target file name for the datasources
provisioning file. This way the module can be used to generate placeholder
files so password can be sepecified in a different iteration, avoiding them
to be put in the module code.

##### `rpm_iteration`

Used when installing Grafana from package ('package' or 'repo' install methods)
Expand All @@ -328,8 +342,7 @@ Defaults to 'grafana-server'.

##### `version`

The version of Grafana to install and manage. Defaults to the latest version of
Grafana available at the time of module release.
The version of Grafana to install and manage. Defaults to 'installed'

##### `sysconfig_location`

Expand Down Expand Up @@ -617,6 +630,15 @@ grafana_plugin { 'grafana-simple-json-datasource':
}
```

It is possible to specify a custom plugin repository to install a plugin. This will use the --repo option for plugin installation with grafana_cli.

```puppet
grafana_plugin { 'grafana-simple-json-datasource':
ensure => present,
repo => 'https://nexus.company.com/grafana/plugins',
}
```

##### `grafana::user`

Creates and manages a global grafana user via the API.
Expand All @@ -641,7 +663,7 @@ provisioning](http://docs.grafana.org/administration/provisioning/).

This module will provision grafana by placing yaml files into
`/etc/grafana/provisioning/datasources` and
`/etc/grafana/provisioning/dashboards`.
`/etc/grafana/provisioning/dashboards` by default.

##### Example datasource

Expand Down Expand Up @@ -682,7 +704,7 @@ grafana::provisioning_datasources:
An example puppet hash for provisioning dashboards. The module will
place the hash as a yaml file into
`/etc/grafana/provisioning/dashboards/puppetprovisioned.yaml`. More details follow the examples.
`/etc/grafana/provisioning/dashboards/puppetprovisioned.yaml` by default. More details follow the examples.

```puppet
class { 'grafana':
Expand Down
7 changes: 6 additions & 1 deletion lib/puppet/provider/grafana_plugin/grafana_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def exists?
end

def create
grafana_cli('plugins', 'install', resource[:name])
if resource[:repo]
repo = "--repo #{resource[:repo]}"
grafana_cli(repo, 'plugins', 'install', resource[:name])
else
grafana_cli('plugins', 'install', resource[:name])
end
@property_hash[:ensure] = :present
end

Expand Down
Loading