From 8144fdb0999d200ed596620711fb142c0b118a52 Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 20 Apr 2022 11:07:36 +0100 Subject: [PATCH 1/2] (maint) PDK Update --- .github/workflows/nightly.yml | 2 +- .github/workflows/spec.yml | 8 ++++---- metadata.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c8fe88a..42816e7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -200,5 +200,5 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} # Optional Input - channel: '#team-ia-bots' + channel: '#team-cat-bots' name: 'GABot' diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 2f6aa53..6c1ae10 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -54,10 +54,10 @@ jobs: buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV -# - name: Run Static & Syntax Tests -# if: ${{ github.repository_owner == 'puppetlabs' }} -# run: | -# buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop + - name: Run Static & Syntax Tests + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop - name: Setup Spec Test Matrix id: get-matrix diff --git a/metadata.json b/metadata.json index 8f9a857..d594103 100644 --- a/metadata.json +++ b/metadata.json @@ -90,6 +90,6 @@ } ], "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", - "template-ref": "heads/main-0-gf3911d3", + "template-ref": "heads/main-0-g806810b", "pdk-version": "2.3.0" } From ed0a32c3ead1748d95a22e5adc970c3bd5817a2e Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 20 Apr 2022 12:48:12 +0100 Subject: [PATCH 2/2] (maint) syntax:hiera:yaml fixes --- examples/group_common.pp | 2 +- examples/user_group_hash.pp | 2 +- manifests/home_dir.pp | 2 +- manifests/init.pp | 3 +-- manifests/key_management.pp | 4 +--- manifests/manage_keys.pp | 3 +-- manifests/user.pp | 12 +++++------- manifests/user/defaults.pp | 4 +--- 8 files changed, 12 insertions(+), 20 deletions(-) diff --git a/examples/group_common.pp b/examples/group_common.pp index f7d7804..7fdc859 100644 --- a/examples/group_common.pp +++ b/examples/group_common.pp @@ -4,7 +4,7 @@ $users_hash = { 'jblow' => { 'comment' => 'Joe Blow', - 'groups' => [ wheel ], + 'groups' => [wheel], 'uid' => '1115', 'gid' => '1115', 'group' => 'mrblow', diff --git a/examples/user_group_hash.pp b/examples/user_group_hash.pp index c80b6db..c313656 100644 --- a/examples/user_group_hash.pp +++ b/examples/user_group_hash.pp @@ -12,7 +12,7 @@ 'jeff' => { 'shell' => '/bin/zsh', 'comment' => 'Jeff McCune', - 'groups' => [ admin, sudonopw, ], + 'groups' => [admin, sudonopw,], 'uid' => '1112', 'gid' => '1112', 'locked' => true, diff --git a/manifests/home_dir.pp b/manifests/home_dir.pp index ffca6ef..4e515f0 100644 --- a/manifests/home_dir.pp +++ b/manifests/home_dir.pp @@ -49,7 +49,7 @@ # # @api private # -define accounts::home_dir( +define accounts::home_dir ( Enum['absent','present'] $ensure = 'present', Optional[String] $bash_profile_content = undef, Optional[Stdlib::Filesource] $bash_profile_source = undef, diff --git a/manifests/init.pp b/manifests/init.pp index 82c81d9..f441ec6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,8 +21,7 @@ Accounts::Group::Hash $group_list = {}, Accounts::User::Resource $user_defaults = {}, Accounts::User::Hash $user_list = {}, -) -{ +) { ensure_resources('group', $group_list, $group_defaults) ensure_resources('accounts::user', $user_list, $user_defaults) } diff --git a/manifests/key_management.pp b/manifests/key_management.pp index 881935e..01a0639 100644 --- a/manifests/key_management.pp +++ b/manifests/key_management.pp @@ -33,7 +33,7 @@ # # @api private # -define accounts::key_management( +define accounts::key_management ( Accounts::User::Name $user, Enum['absent','present'] $ensure = 'present', Optional[Accounts::User::Name] $group = undef, @@ -45,7 +45,6 @@ Array[String] $sshkeys = [], Optional[Stdlib::Unixpath] $user_home = undef, ) { - if $user_home { $sshkey_dotdir = "${user_home}/.ssh" } @@ -79,7 +78,6 @@ $sshkey_require = File[$sshkey_dotdir] } $sshkey_before = undef - } else { if $purge_user_home and $user_home { file { $sshkey_dotdir: diff --git a/manifests/manage_keys.pp b/manifests/manage_keys.pp index 38cb65c..13907c0 100644 --- a/manifests/manage_keys.pp +++ b/manifests/manage_keys.pp @@ -18,14 +18,13 @@ # # @api private # -define accounts::manage_keys( +define accounts::manage_keys ( Stdlib::Unixpath $key_file, String $keyspec, Accounts::User::Name $user, Enum['absent','present'] $ensure = 'present', Accounts::User::Name $key_owner = $user, ) { - $key_def = accounts_ssh_authorized_keys_line_parser($keyspec) if (! $key_def) { err("Could not interpret SSH key definition: '${keyspec}'") diff --git a/manifests/user.pp b/manifests/user.pp index 68ec59a..5b23299 100644 --- a/manifests/user.pp +++ b/manifests/user.pp @@ -208,7 +208,7 @@ Boolean $purge_sshkeys = false, Boolean $purge_user_home = false, Optional[String] $salt = undef, - Optional[Stdlib::Unixpath] $shell = '/bin/bash', + Stdlib::Unixpath $shell = '/bin/bash', Optional[Stdlib::Unixpath] $sshkey_custom_path = undef, Optional[Accounts::User::Name] $sshkey_group = $group, Optional[Accounts::User::Name] $sshkey_owner = $name, @@ -217,7 +217,6 @@ Boolean $system = false, Optional[Accounts::User::Uid] $uid = undef, ) { - assert_type(Accounts::User::Name, $name) include accounts::user::defaults @@ -332,7 +331,7 @@ forward_source => $forward_source, user => $name, group => $group, - require => [ User[$name] ], + require => [User[$name]], } accounts::key_management { "${name}_key_management": ensure => 'present', @@ -345,7 +344,7 @@ sshkey_group => $sshkey_group, sshkey_mode => $sshkey_mode, purge_user_home => $purge_user_home, - require => Accounts::Home_dir[$_home] + require => Accounts::Home_dir[$_home], } } elsif $sshkeys != [] { # We are not managing the user's home directory but we have specified a @@ -361,9 +360,8 @@ sshkey_mode => $sshkey_mode, sshkey_custom_path => $sshkey_custom_path, } - } - else { - warning("ssh keys were passed for user ${name} but $managehome is set to false; not managing user ssh keys") + } else { + warning("ssh keys were passed for user ${name} but managehome is set to false; not managing user ssh keys") } } } diff --git a/manifests/user/defaults.pp b/manifests/user/defaults.pp index ad8c151..a9dd704 100644 --- a/manifests/user/defaults.pp +++ b/manifests/user/defaults.pp @@ -14,8 +14,6 @@ Stdlib::AbsolutePath $home_template = '/home/%s', Stdlib::AbsolutePath $locked_shell = '/sbin/nologin', Stdlib::AbsolutePath $root_home = '/root', -) -{ +) { # Nothing to see here; move along. } -