Skip to content

Create Stdlib::File::* types#1298

Open
ekohl wants to merge 2 commits intopuppetlabs:mainfrom
ekohl:file-type-aliases
Open

Create Stdlib::File::* types#1298
ekohl wants to merge 2 commits intopuppetlabs:mainfrom
ekohl:file-type-aliases

Conversation

@ekohl
Copy link
Collaborator

@ekohl ekohl commented Mar 10, 2023

This creats a Stdlib::File namespace for file attributes. It introduces Stdlib::File::Content, but I'm not sure if this is complete. https://www.puppet.com/docs/puppet/7/type.html#file-attribute-content doesn't describe valid or invalid input. Please discuss what should be accepted.

@ekohl ekohl requested a review from a team as a code owner March 10, 2023 12:46
@@ -0,0 +1,2 @@
# @summary Validate a file content attribute
type Stdlib::File::Content = Variant[String, Sensitive[String], Deferred[String]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

TIL: this can also be Binary

Previously these were prefixed, but this creates an explicit namespace.
bastelfreak
bastelfreak previously approved these changes Apr 23, 2023

require 'spec_helper'

describe 'Stdlib::Filemode' do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
describe 'Stdlib::Filemode' do
describe 'Stdlib::File::Content' do

This should describe the valid input for content. It doesn't list Undef
so module authors can enforce content is set. If it's optional,
Optional[Stdlib::File::Content] is easy to use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants