Skip to content
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

apt::setting: Parse type and name from title. #444

Merged
merged 1 commit into from Feb 26, 2015

Conversation

daenney
Copy link

@daenney daenney commented Feb 26, 2015

Instead of having two additional parameters, base_name and setting_type simply parse it from title.

We need to prefix most resources with list-, conf-, or pref- any way to avoid duplicate resources so we might as well leverage that.

@daenney daenney added this to the 2.0 milestone Feb 26, 2015
@daenney daenney force-pushed the daenney/parse-setting-from-name branch from ce4ed56 to 75487c1 Compare February 26, 2015 18:18
$setting_type = $title_array[0]
$base_name = join(delete_at($title_array, 0), '-')

validate_re($setting_type, ['^conf', '^pref', '^list'], "apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")

Choose a reason for hiding this comment

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

should these be ^conf$, ^pref$ and ^list$?

Copy link
Author

Choose a reason for hiding this comment

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

Damn it 😝.

@daenney daenney force-pushed the daenney/parse-setting-from-name branch from 75487c1 to c67798c Compare February 26, 2015 18:25
@@ -31,8 +31,6 @@
}

apt::setting { 'conf-update-stamp':
base_name => 'update-stamp',
setting_type => 'conf',
priority => 15,
content => template('apt/_header.erb', 'apt/15update-stamp.erb'),

Choose a reason for hiding this comment

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

Extra spaces before =>

Instead of having two additional parameters, `base_name` and
`setting_type` simply parse it from `title`.

We need to prefix most resources with `list-`, `conf-`, or `pref-` any
way to avoid duplicate resources so we might as well leverage that.
@daenney daenney force-pushed the daenney/parse-setting-from-name branch from c67798c to d261d8f Compare February 26, 2015 19:15
underscorgan pushed a commit that referenced this pull request Feb 26, 2015
apt::setting: Parse type and name from title.
@underscorgan underscorgan merged commit a21c183 into next Feb 26, 2015
@daenney daenney deleted the daenney/parse-setting-from-name branch February 26, 2015 19:29
@LukasAud LukasAud added the bugfix label Jun 7, 2023
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.

None yet

3 participants