Skip to content

(CONT-567) allow deferred function for password #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2023
Merged

Conversation

Ramesh7
Copy link
Contributor

@Ramesh7 Ramesh7 commented May 18, 2023

  • implementing deferred function for password field

@Ramesh7 Ramesh7 requested a review from a team as a code owner May 18, 2023 12:15
@puppet-community-rangefinder
Copy link

sqlserver::password is a function

that may have no external impact to Forge modules.

sqlserver::login is a type

that may have no external impact to Forge modules.

sqlserver::user is a type

that may have no external impact to Forge modules.

This module is declared in 3 of 580 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@Ramesh7 Ramesh7 force-pushed the CONT-567 branch 2 times, most recently from 54037ca to 7cf4081 Compare May 18, 2023 15:07
end

# the function below is called by puppet and and must match
# the name of the puppet function above. You can set your
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfinished comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!!

# @summary This function exists for usage of a role password that is a deferred function
Puppet::Functions.create_function(:'sqlserver::password') do
dispatch :password do
optional_param 'Any', :pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested in the types here.

I wonder if we should be more prescriptive? For example, would String be a better choice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chelnak the password is not mandetory field here so restricting with String will lead to make it mandetory. That's why I have added to any type.
Ref : https://github.com/puppetlabs/puppetlabs-sqlserver/blob/main/manifests/login.pp#L59
Please let me know if we wanted to make it required field.

sqlserver_tsql { "user-${instance}-${database}-${user}":
instance => $instance,
command => template("sqlserver/${create_delete}/user.sql.erb"),
command => Deferred('inline_epp', [file("sqlserver/${create_delete}/user.sql.epp"), $parameters]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added Deferred looking at compatibility. The deferrable_epp recently got added and will not available with Puppet 7.
If we make sure it will always get used with Puppet 8 then we are good to deferrable_epp.pp otherwise we still need to stick with Deferred.
Please suggest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I haven't see any references on doc about https://www.puppet.com/docs/puppet/8/deferring_functions.html so stick with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chelnak addressed your comment, can you please re-look. Thanks

@Ramesh7 Ramesh7 force-pushed the CONT-567 branch 2 times, most recently from 1cea6e2 to a13e824 Compare May 19, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants