Skip to content

Commit

Permalink
Fix issues on Windows and add CI testing
Browse files Browse the repository at this point in the history
Signed-off-by: Lance Albertson <[email protected]>
  • Loading branch information
ramereth committed Mar 15, 2021
1 parent 98326b9 commit 2747049
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,31 @@ jobs:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

windows-latest:
needs: [mdl, yamllint, delivery]
runs-on: windows-latest
strategy:
matrix:
os:
- 'windows-latest'
suite:
- 'default'
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
- name: test-kitchen
uses: actionshub/test-kitchen@master
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

macos-latest:
needs: [mdl, yamllint, delivery]
runs-on: macos-latest
Expand All @@ -92,7 +117,7 @@ jobs:
os: ${{ matrix.os }}

final:
needs: [dokken, macos-latest]
needs: [dokken, windows-latest, macos-latest]
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the users cookbook.

## Unreleased

- Fix issues on Windows and add CI testing

## 6.0.0 - *2021-03-12*

- Removed hard dependency on data bags. See upgrading.md for details
Expand Down
1 change: 1 addition & 0 deletions kitchen.exec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ provisioner:

platforms:
- name: macos-latest
- name: windows-latest
10 changes: 10 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ platforms:
- name: opensuse-leap-15
- name: ubuntu-18.04
- name: ubuntu-20.04
- name: windows-2019
driver:
gui: false
box: tas50/windows_2019
customize:
cpus: 2
memory: 4096
transport:
name: winrm
elevated: true

suites:
- name: default
Expand Down
4 changes: 2 additions & 2 deletions resources/manage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
else
gid user[:gid].to_i
end
only_if { user[:gid] && user[:gid].is_a?(Numeric) && username_group }
only_if { user[:gid] && user[:gid].is_a?(Numeric) && username_group && !platform_family?('windows') }
end

# Create user object.
# Do NOT try to manage null home directories.
user username do
uid user[:uid].to_i unless platform_family?('mac_os_x') || !user[:uid]
gid user[:gid].to_i if user[:gid]
gid user[:gid].to_i if user[:gid] && !platform_family?('windows')
shell shell_is_valid?(user[:shell]) ? user[:shell] : '/bin/sh'
comment user[:comment]
password user[:password] if user[:password]
Expand Down

0 comments on commit 2747049

Please sign in to comment.