Commit 9220931f authored by Lance Albertson's avatar Lance Albertson

Sous Chefs Adoption

- Standardise files with files in sous-chefs/repo-management

**Note: Disable unit tests for the `cron_d` resource since its now included in
Chef and causes issues with testing these resources. We'll remove it in a later
release**
Signed-off-by: default avatarLance Albertson <lance@osuosl.org>
parent 35579fde
---
name: Branch Cleanup
# This workflow is triggered on all closed pull requests.
# However the script does not do anything if a merge was not performed.
"on":
pull_request:
types: [closed]
env:
NO_BRANCH_DELETED_EXIT_CODE: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: jessfraz/branch-cleanup-action@master
---
name: ci
"on":
pull_request:
push:
branches:
- master
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
yamllint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run yaml Lint
uses: actionshub/yamllint@master
mdl:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Markdown Lint
uses: actionshub/markdownlint@master
dokken:
needs: [delivery]
runs-on: ubuntu-latest
strategy:
matrix:
os:
- 'amazonlinux-2'
- 'centos-7'
- 'centos-8'
- 'debian-9'
- 'debian-10'
- 'fedora-latest'
- 'opensuse-leap-15'
- 'ubuntu-1804'
- 'ubuntu-2004'
suite:
- 'default'
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
- name: Dokken
uses: actionshub/kitchen-dokken@master
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
final:
needs: [dokken]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
name: delivery
on: [push, pull_request]
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
\ No newline at end of file
rules "~MD013", "~MD024", "~MD025"
addons:
apt:
sources:
- chef-current-xenial
packages:
- chef-workstation
install: echo "skip bundle install"
env:
- CHEF_LICENSE=accept
branches:
only:
- master
services: docker
env:
matrix:
- INSTANCE=default-centos-6 CHEF_VERSION=13
- INSTANCE=default-centos-7 CHEF_VERSION=13
- INSTANCE=default-debian-9 CHEF_VERSION=13
- INSTANCE=default-debian-10 CHEF_VERSION=13
- INSTANCE=default-fedora-latest CHEF_VERSION=13
- INSTANCE=default-ubuntu-1604 CHEF_VERSION=13
- INSTANCE=default-ubuntu-1804 CHEF_VERSION=13
- INSTANCE=default-opensuse-leap-15 CHEF_VERSION=13
- INSTANCE=default-amazonlinux CHEF_VERSION=13
- INSTANCE=default-amazonlinux-2 CHEF_VERSION=13
- INSTANCE=manage-centos-7 CHEF_VERSION=13
- INSTANCE=default-centos-6 CHEF_VERSION=14
- INSTANCE=default-centos-7 CHEF_VERSION=14
- INSTANCE=default-centos-8 CHEF_VERSION=14
- INSTANCE=default-debian-9 CHEF_VERSION=14
- INSTANCE=default-debian-10 CHEF_VERSION=14
- INSTANCE=default-fedora-latest CHEF_VERSION=14
- INSTANCE=default-ubuntu-1604 CHEF_VERSION=14
- INSTANCE=default-ubuntu-1804 CHEF_VERSION=14
- INSTANCE=default-opensuse-leap-15 CHEF_VERSION=14
- INSTANCE=default-amazonlinux CHEF_VERSION=14
- INSTANCE=default-amazonlinux-2 CHEF_VERSION=14
- INSTANCE=manage-centos-7 CHEF_VERSION=14
- INSTANCE=default-centos-6
- INSTANCE=default-centos-7
- INSTANCE=default-centos-8
- INSTANCE=default-debian-9
- INSTANCE=default-debian-10
- INSTANCE=default-fedora-latest
- INSTANCE=default-ubuntu-1604
- INSTANCE=default-ubuntu-1804
- INSTANCE=default-opensuse-leap-15
- INSTANCE=default-amazonlinux
- INSTANCE=default-amazonlinux-2
- INSTANCE=manage-centos-7
before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(chef shell-init bash)"
- chef --version
script: KITCHEN_LOCAL_YAML=kitchen.dokken.yml CHEF_VERSION=${CHEF_VERSION} kitchen verify ${INSTANCE}
matrix:
include:
- script:
- delivery local all
env:
- UNIT_AND_LINT=1
- CHEF_LICENSE=accept
# cron Cookbook CHANGELOG
This file is used to list changes made in each version of the cron cookbook.
## Unreleased
- Sous Chefs Adoption
- Standardise files with files in sous-chefs/repo-management
## 6.3.1 (2020-06-09)
- Ensure we have both resource_name and provides in resources - [@tas50](https://github.com/tas50)
......@@ -27,7 +33,7 @@ This file is used to list changes made in each version of the cron cookbook.
## 6.2.0 (2018-07-24)
- Finish the random_delay property begun in https://github.com/chef-cookbooks/cron/pull/103
- Finish the random_delay property begun [in](https://github.com/chef-cookbooks/cron/pull/103)
## 6.1.1 (2018-05-11)
......@@ -122,21 +128,27 @@ This file is used to list changes made in each version of the cron cookbook.
- Cleanup the cron.d jobs with the non-santized filenames to prevent duplicate job jobs if cron < 1.7.4 was ever run on the node
## v1.7.5 (2016-03-01)
- Fixes '* is not valid value for validate_numeric' errors
- Fixes `* is not valid value for validate_numeric` errors
## v1.7.4 (2016-02-16)
- Sanitize cron job names in the custom resource to replace '.' with '-'
## v1.7.3 (2015-12-20)
- Re-release to remove DS Store file that snuck in
## v1.7.2 (2015-12-14)
- Fixed the inability to delete a cron job without specifying the command. Expanded tests to cover this scenario and the create_if_missing action
## v1.7.1 (2015-12-11)
- #65 - Added action create_if_missing for cron jobs you want to create, but not modify later
## v1.7.0 (2015-10-05)
- Added Arch Linux support
- Added FreeBSD support, which emulates /etc/cron.d folder support and builds a single /etc/crontab file using the contents of /etc/cron.d
- Ensure that the cron package is installed on Debian based systems
......@@ -158,76 +170,100 @@ This file is used to list changes made in each version of the cron cookbook.
- Updated Chefspec for 4.X format
## v1.6.1 (2014-10-15)
- [#48] fix typo apry -> apr
## v1.6.0 (2014-09-24)
- [36] Add environment parameter to LWRP
- [38] Allow user to specify file permissions
## v1.5.0 (2014-09-15)
- [#25] Fixes NameError exception on :delete
- [#33] Updates README
- [#40] Fixes local test-kitchen config
- [#20] Implements a comment for cron_d provider
## v1.4.3 (2014-09-09)
- [#46] Fixes a broken case statement causing cron_d to fail
## v1.4.2 (2014-09-08)
- [#31] Fix up validate_month for Fixnums
- [#32] Fix upvalidate_dow for Fixnums
## v1.4.0 (2014-05-07)
- [COOK-4628] Adding cron_manage to allow or deny users
## v1.3.12 (2014-04-23)
- [COOK-4550] - cron_d resource sometimes does not print the time in the cron output
- PR #23 fix validate month and dow
- Updating test harness, adding specs
## v1.3.10 (2014-04-10)
- [COOK-4507] - restore ability to use @ fields
## v1.3.8 (2014-04-10)
- [COOK-4544] fixing NameError exception on :delete action
## v1.3.6 (2014-04-09)
- [COOK-4337] fixing validations
## v1.3.4 (2014-04-09)
- Reverting [COOK-4337] - cron cookbook does no input validation
## v1.3.2 (2014-03-27)
- [COOK-4337] - cron cookbook does no input validation
- [COOK-4229] - Support the Gentoo package
## v1.3.0 (2014-02-25)
### New Feature
- **[COOK-4112](https://tickets.chef.io/browse/COOK-4112)** - Solaris 11 support for cron
### Bug
- **[COOK-3813](https://tickets.chef.io/browse/COOK-3813)** - Add metadata for recipes in the cron cookbook
## v1.2.8
### Bug
- **[COOK-3452](https://tickets.chef.io/browse/COOK-3452)** - Add support for raspbian platform
## v1.2.6
### Improvement
- **[COOK-3005](https://tickets.chef.io/browse/COOK-3005)** - Remove blankline in template
## v1.2.4
- [COOK-3058]: simplify conditionals in cron recipe
## v1.2.2
- [COOK1829] - `cron_d` LWRPtemplate should imply cron cookbook by default
## v1.2.0
- [COOK-938] - don't default to upgrading cron and fix rhel6 package name
- [COOK-1622] - add LWRP for cron.d files
## v1.0.4
- [COOK-1514] - Cron cookbook manages wrong service name on SuSE
## v1.0.0
- [COOK-1124] - add RHEL platform support
# cron Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/cron.svg?branch=master)](https://travis-ci.org/chef-cookbooks/cron) [![Cookbook Version](https://img.shields.io/cookbook/v/cron.svg)](https://supermarket.chef.io/cookbooks/cron)
[![Cookbook Version](https://img.shields.io/cookbook/v/cron.svg)](https://supermarket.chef.io/cookbooks/cron)
[![CI State](https://github.com/sous-chefs/cron/workflows/ci/badge.svg)](https://github.com/sous-chefs/cron/actions?query=workflow%3Aci)
[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
Installs the cron package and starts the crond service.
Note: Chef 14.4 shipped with the cron_d and cron_access (cron_manage) resources. When Chef 15.4 ships in Aug 2019 these resources will be removed from this cookbook as all users should be on Chef 14.4 or later.
## Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
## Requirements
### Platforms
......@@ -33,7 +41,7 @@ The `cron_d` custom resource can be used to manage files in `/etc/cron.d`. It su
#### Properties
- `cron_name` - Set the name of the cron job. If this isn't specified we'll use the resource name.
- `minute`, `hour`, `day`, `month`, `weekday` - schedule your cron job. These correspond exactly to their equivalents in the crontab file. All default to "*".
- `minute`, `hour`, `day`, `month`, `weekday` - schedule your cron job. These correspond exactly to their equivalents in the crontab file. All default to "\*".
- `predefined_value` - schedule your cron job with one of the special predefined value instead of _**_ * pattern. This correspond to `"@reboot"`, `"@yearly"`, `"@annually"`, `"@monthly"`, `"@weekly"`, `"@daily"`, `"@midnight"` or `"@hourly"`.
- `command` - the command to run. Required.
- `user` - the user to run as. Defaults to "root".
......@@ -97,24 +105,27 @@ cron_access "Make sure john can't touch cron" do
end
```
## Maintainers
## Contributors
This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
## License
### Backers
**Copyright:** 2010-2018, Chef Software, Inc.
Thank you to all our backers!
```
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40)
http://www.apache.org/licenses/LICENSE-2.0
### Sponsors
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
privileged: true # because Docker and SystemD
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
chef_license: accept-no-persist
......@@ -9,71 +9,57 @@ transport:
provisioner:
name: dokken
deprecations_as_errors: true
verifier:
name: inspec
platforms:
- name: amazonlinux
driver:
image: dokken/amazonlinux
pid_one_command: /sbin/init
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
......@@ -3,6 +3,7 @@ driver:
provisioner:
name: chef_zero
product_name: chef
deprecations_as_errors: true
chef_license: accept-no-persist
......@@ -10,21 +11,17 @@ verifier:
name: inspec
platforms:
- name: amazonlinux
driver_config:
box: mvbcoding/awslinux
- name: amazonlinux-2
- name: centos-6
- name: centos-7
- name: centos-8
- name: debian-9
- name: debian-10
- name: fedora-latest
- name: opensuse-leap-15
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: ubuntu-20.04
suites:
- name: default
run_list:
- recipe[test::default]
- name: default
run_list:
- recipe[test::default]
name 'cron'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs cron'
version '6.3.1'
name 'cron'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Installs cron'
version '6.3.1'
source_url 'https://github.com/sous-chefs/cron'
issues_url 'https://github.com/sous-chefs/cron/issues'
chef_version '>= 12.15'
%w(ubuntu debian fedora redhat centos scientific oracle amazon smartos omnios solaris2 freebsd zlinux opensuse suse opensuseleap).each do |os|
supports os
end
source_url 'https://github.com/chef-cookbooks/cron'
issues_url 'https://github.com/chef-cookbooks/cron/issues'
chef_version '>= 12.15'
supports 'amazon'
supports 'centos'
supports 'debian'
supports 'fedora'
supports 'freebsd'
supports 'omnios'
supports 'opensuse'
supports 'opensuseleap'
supports 'oracle'
supports 'redhat'
supports 'scientific'
supports 'smartos'
supports 'solaris2'
supports 'suse'
supports 'ubuntu'
supports 'zlinux'
require 'spec_helper'
describe 'test::default' do
cached(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge('test::default') }
cached(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '20.04').converge('test::default') }
it 'enables and starts service[cron]' do
expect(chef_run).to enable_service('cron')
expect(chef_run).to start_service('cron')
end
it 'creates cron_d[bizarrely-scheduled-usage-report]' do
expect(chef_run).to create_cron_d('bizarrely-scheduled-usage-report').with(
minute: '*/5',
hour: '1,23',
day: '2-5',
command: '/srv/app/scripts/generate_report',
user: 'appuser'
)
end
it 'creates cron_d[test-month-usage-report]' do
expect(chef_run).to create_cron_d('test-month-usage-report').with(
minute: '0',
hour: '6',
month: '1',
command: '/srv/app/scripts/generate_report',
user: 'appuser'
)
end
it 'creates cron_d[fixnum-job]' do
expect(chef_run).to create_cron_d('fixnum-job').with(
minute: 0,
hour: 1,
day: 2,
command: '/bin/true',
user: 'appuser'