Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

sqlserver::user::permissions always applied as corrective

オープン 初心者向け
#509 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

@davidassigbi がすでに取り組んでいます。

2026年7月29日 から。

  • #508 @davidassigbi による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
92/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
sql
領域
databases

調査の方向性

templates/query/user/permission_exists.sql.epp から始め、templates/create/user/permission.sql.epp および templates/query/role/permission_exists.sql.epp と比較します。permission 変数の設定を確認してから、記載されている Puppet の再現を 2 回実行します。完了条件は、2 回目の実行で sqlserver_tsql リソースが同期済みと報告され、GRANT 権限が再適用されないことです。

索引モデルが issue の本文から書いたものです。

説明

bugfix community

Describe the Bug

When declaring sqlserver::user::permissions with GRANT permissions, Puppet re-applies the permissions on every run as a corrective change, even though the permissions are already in the desired state.

Expected Behavior

On the second Puppet run (after permissions are already granted), the sqlserver_tsql resource should be in sync and no corrective change should occur.

Steps to Reproduce

  1. Declare sqlserver::user::permissions with e.g. permissions: ['SELECT', 'INSERT'] and state: GRANT
  2. Run Puppet agent — permissions are applied
  3. Run Puppet agent again — permissions are re-applied as corrective

Root Cause

The onlyif query template templates/query/user/permission_exists.sql.epp iterates over permissions but never assigns the SQL variable @permission:

<% $permissions.each |$requested_permission| { %>
    <% $permission = $requested_permission.upcase %>
<%= epp('sqlserver/snippets/user/permission/exists.sql.epp', ...) %>
<% } %>

The Puppet variable $permission is set, but the SQL variable @permission stays NULL. Since permission_name = NULL is never TRUE in SQL Server, the subquery always returns NULL, ISNULL coerces it to 'REVOKE', and the check always sees a mismatch — causing Puppet to re-grant every time.

The create template (templates/create/user/permission.sql.epp) and the role equivalent (templates/query/role/permission_exists.sql.epp) both correctly set @permission. This is the same class of bug as #464 / #500 which fixed the login permission template.

Fix

Add the missing SET @permission = '<%= $permission %>'; line in the query template, matching the create template.

主要言語
Ruby
スター
5
フォーク
23
平均マージ
3時間 17分
マージ済み PR(30日)
1

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

puppetlabs/puppetlabs-sqlserver のほかの issue

puppetlabs/puppetlabs-sqlserver の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。