5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
fixtures:
repositories:
facts: 'git://github.com/puppetlabs/puppetlabs-facts.git'
puppet_agent: 'git://github.com/puppetlabs/puppetlabs-puppet_agent.git'
provision: 'git://github.com/puppetlabs/provision.git'
symlinks:
service: "#{source_dir}"
8 changes: 6 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Expand All @@ -19,10 +21,12 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
- spec/**/*
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand Down
43 changes: 6 additions & 37 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
required:
- ---.project

appveyor.yml:
unmanaged: true

.gitlab-ci.yml:
unmanaged: true

.travis.yml:
docker_sets:
- set: docker/centos-7
- set: docker/ubuntu-14.04
docker_defaults:
bundler_args: ""
script: bundle exec rake beaker
secure: ""
global_env:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- GEM_BOLT=true
branches:
- release
remove_includes:
- env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.5
stage: spec
unmanaged: true

Gemfile:
optional:
Expand All @@ -31,29 +19,10 @@ Gemfile:
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
required:
':system_tests':
- gem: 'puppet-module-posix-system-r#{minor_version}'
platforms: ruby
- gem: 'puppet-module-win-system-r#{minor_version}'
platforms:
- mswin
- mingw
- x64_mingw
- gem: bolt
version: '~> 1.15'
condition: ENV['GEM_BOLT']

Rakefile:
extras: |
# The beaker task requires the test fixtures created by the spec_prep task
beaker_task_exists = Rake::Task.task_defined?('beaker')
spec_prep_task_exists = Rake::Task.task_defined?('spec_prep')
if beaker_task_exists && spec_prep_task_exists
beaker_task = Rake::Task['beaker']
spec_prep = Rake::Task['spec_prep']
beaker_task.enhance(beaker_task.prerequisite_tasks << spec_prep)
end
requires:
- puppet_pot_generator/rake_tasks

spec/spec_helper.rb:
mock_with: ':rspec'
Expand Down
75 changes: 49 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
dist: trusty
language: ruby
cache: bundler
before_install:
Expand All @@ -14,46 +15,68 @@ rvm:
- 2.5.3
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- GEM_BOLT=true
stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
- PUPPET_GEM_VERSION="~> 6.0"
matrix:
fast_finish: true
include:
-
bundler_args:
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/centos-7 BEAKER_TESTMODE=apply
rvm: 2.5.3
script: bundle exec rake beaker
env: PLATFORMS=deb_puppet5
rvm: 2.5.1
before_script:
- bundle exec rake 'litmus:provision_list[waffle_deb]'
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
- bundle exec rake 'litmus:install_agent[puppet5]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:serial
services: docker
stage: acceptance
sudo: required
-
bundler_args:
bundler_args:
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_set=docker/ubuntu-14.04 BEAKER_TESTMODE=apply
rvm: 2.5.3
script: bundle exec rake beaker
env: PLATFORMS=deb_puppet6
rvm: 2.5.1
before_script:
- bundle exec rake 'litmus:provision_list[waffle_deb]'
- bundle exec bolt command run 'apt-get install wget -y' --inventoryfile inventory.yaml --nodes='localhost*'
- bundle exec rake 'litmus:install_agent[puppet6]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:serial
services: docker
stage: acceptance
sudo: required
-
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
stage: static
bundler_args:
dist: trusty
env: PLATFORMS=el_puppet5
rvm: 2.5.1
before_script:
- bundle exec rake 'litmus:provision_list[waffle_el]'
- bundle exec rake 'litmus:install_agent[puppet5]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:serial
services: docker
sudo: required
-
bundler_args:
dist: trusty
env: PLATFORMS=el_puppet6
rvm: 2.5.1
before_script:
- bundle exec rake 'litmus:provision_list[waffle_el]'
- bundle exec rake 'litmus:install_agent[puppet6]'
- bundle exec rake litmus:install_module
script:
- bundle exec rake litmus:acceptance:serial
services: docker
sudo: required
-
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
rvm: 2.5.3
stage: spec
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
env: CHECK=parallel_spec
branches:
only:
- master
Expand Down
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"rebornix.Ruby"
]
}
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v1.0.0](https://github.com/puppetlabs/puppetlabs-service/tree/v1.0.0) (2019-04-24)
## [v1.1.0](https://github.com/puppetlabs/puppetlabs-service/tree/v1.1.0) (2019-09-20)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-service/compare/v0.6.0...v1.0.0)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-service/compare/1.0.0...v1.1.0)

### Added

- \(FM-8212\) Convert to acceptance testing to litmus [\#103](https://github.com/puppetlabs/puppetlabs-service/pull/103) ([michaeltlombardi](https://github.com/michaeltlombardi))
- \(MODULES-9230\) Force Windows Service Action [\#99](https://github.com/puppetlabs/puppetlabs-service/pull/99) ([RandomNoun7](https://github.com/RandomNoun7))
- \(FM-8159\) Add Windows Server 2019 support [\#98](https://github.com/puppetlabs/puppetlabs-service/pull/98) ([eimlav](https://github.com/eimlav))
- \(FM-8047\) Add RedHat8 as supported OS [\#97](https://github.com/puppetlabs/puppetlabs-service/pull/97) ([michaeltlombardi](https://github.com/michaeltlombardi))

## [1.0.0](https://github.com/puppetlabs/puppetlabs-service/tree/1.0.0) (2019-04-24)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-service/compare/v0.6.0...1.0.0)

### Changed

Expand Down
28 changes: 12 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "bolt", '~> 1.15', require: false if ENV['GEM_BOLT']
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,40 @@

#### Table of Contents

1. [Description](#description)
2. [Requirements](#requirements)
3. [Usage - Configuration options and additional functionality](#usage)
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Getting help - Some Helpful commands](#getting-help)
1. [Overview](#overview)
2. [Module Description](#module-description)
3. [Setup](#setup)
* [Requirements](#requirements)
4. [Usage](#usage)
* [Default task](#default-task)
* [Linux task](#linux-task)
* [Windows task](#windows-task)
5. [Reference](#reference)
6. [Limitations](#limitations)
7. [Development](#development)

## Description
## Overview

This module provides services tasks, There are two kinds of tasks. The default task: that uses the puppet agent on the target node to manage and inspect the state of services. The linux task: that manipulates services on a linux derivative without a puppet agent installed on the target node.
Module provides services tasks.

## Module Description

## Requirements
The service module contains two kinds of tasks. The default task: that uses the puppet agent on the target node to manage and inspect the state of services. The linux task: that manipulates services on a linux derivative without a puppet agent installed on the target node.

## Setup

### Requirements
This module is compatible with Puppet Enterprise and Puppet Bolt.

* To run tasks with Puppet Enterprise, PE 2018.1 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must be Puppet agents.

* To run tasks with Puppet Bolt, Bolt 1.0 or later must be installed on the machine from which you are running task commands. Machines receiving task requests must have SSH or WinRM services enabled.

## Usage

To run a service task, use the task command, specifying the action and the name of the service.
* To view the available actions and parameters, on the command line, run `puppet task show service`
* To view the completed list of services that are supported see the Puppet [services](https://docs.puppet.com/puppet/latest/types/service.html) documentation.
* To run a service task, use the task command, specifying the action and the name of the service.
* To show help for the task CLI, run `puppet task run --help` or `bolt task run --help`

### Default task

Expand Down Expand Up @@ -62,18 +74,14 @@ You can also run tasks in the PE console. See PE task documentation for complete

## Reference

To view the available actions and parameters, on the command line, run `puppet task show service` or see the service module page on the [Forge](https://forge.puppet.com/puppetlabs/service/tasks).

For a complete list of services that are supported see the Puppet [services](https://docs.puppet.com/puppet/latest/types/service.html) documentation.
For information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-service/blob/master/REFERENCE.md).

## Limitations

To run acceptance tests against Windows machines, ensure that the `BEAKER_password` environment variable has been set to the password of the Administrator user of the target machine.

For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-service/blob/master/metadata.json)

## Getting Help

To display help for the service task, run `puppet task show service`
## Development

To show help for the task CLI, run `puppet task run --help` or `bolt task run --help`
Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. To contribute to Puppet projects, see our [module contribution guide.](https://github.com/puppetlabs/puppetlabs-service/blob/master/CONTRIBUTING.md)
Loading