pdk 1.18.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +81 -11
- data/README.md +1 -1
- data/lib/pdk/cli.rb +5 -1
- data/lib/pdk/cli/env.rb +52 -0
- data/lib/pdk/cli/exec/command.rb +11 -1
- data/lib/pdk/cli/new.rb +2 -0
- data/lib/pdk/cli/new/fact.rb +29 -0
- data/lib/pdk/cli/new/function.rb +29 -0
- data/lib/pdk/cli/release.rb +3 -1
- data/lib/pdk/cli/release/publish.rb +11 -1
- data/lib/pdk/cli/util/option_validator.rb +6 -0
- data/lib/pdk/config.rb +6 -0
- data/lib/pdk/generate.rb +0 -1
- data/lib/pdk/generate/fact.rb +25 -0
- data/lib/pdk/generate/function.rb +48 -0
- data/lib/pdk/generate/provider.rb +1 -1
- data/lib/pdk/generate/transport.rb +1 -1
- data/lib/pdk/module.rb +1 -0
- data/lib/pdk/module/metadata.rb +6 -2
- data/lib/pdk/module/release.rb +7 -1
- data/lib/pdk/module/update.rb +1 -1
- data/lib/pdk/report.rb +3 -3
- data/lib/pdk/report/event.rb +8 -2
- data/lib/pdk/tests/unit.rb +3 -1
- data/lib/pdk/util/bundler.rb +1 -1
- data/lib/pdk/util/changelog_generator.rb +20 -3
- data/lib/pdk/util/json_finder.rb +1 -0
- data/lib/pdk/util/puppet_version.rb +2 -2
- data/lib/pdk/util/ruby_version.rb +5 -1
- data/lib/pdk/util/template_uri.rb +5 -5
- data/lib/pdk/util/vendored_file.rb +1 -2
- data/lib/pdk/validate/invokable_validator.rb +14 -1
- data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +1 -1
- data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +2 -2
- data/lib/pdk/version.rb +1 -1
- data/lib/pdk/version.rb.orig +9 -0
- metadata +38 -20
- data/lib/pdk/generate/resource_api_object.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e2609c042f89068710f065fadda48fe3ae5f32b
|
4
|
+
data.tar.gz: 40acaf2ef749d5e369387bf345f2ed2cb4588078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774972368cefed1e1100d3ddd3804e216cbf13fbebd5b8af63c93862972e4d2339336aa5e0b48ea7ee7b09dd176eb98f2355dc0fc7b270ac92e0e8a1c6eac271
|
7
|
+
data.tar.gz: e966d37fdcf70b2a90227e3e5eebfc6a611950db8da230930a309f5d57a1a3407c4ee1fb23d1c322c7aaa7b57eaa392b48538ad48991b6de5a8a9e7e2e7550ec
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,76 @@
|
|
3
3
|
All changes to this repo will be documented in this file.
|
4
4
|
See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) for a high-level summary.
|
5
5
|
|
6
|
+
## [v2.2.0](https://github.com/puppetlabs/pdk/tree/v2.2.0) (2021-08-02)
|
6
7
|
|
7
|
-
|
8
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.1.1...v2.2.0)
|
9
|
+
|
10
|
+
**Implemented enhancements:**
|
11
|
+
|
12
|
+
- \(GH-1118\) Add ability to skip validating files [\#1114](https://github.com/puppetlabs/pdk/pull/1114) ([jpogran](https://github.com/jpogran))
|
13
|
+
|
14
|
+
**Fixed bugs:**
|
15
|
+
|
16
|
+
- \(GH-1113\) \(GH-917\) Fix forge-token handling [\#1121](https://github.com/puppetlabs/pdk/pull/1121) ([sanfrancrisko](https://github.com/sanfrancrisko))
|
17
|
+
|
18
|
+
## [v2.1.1](https://github.com/puppetlabs/pdk/tree/v2.1.1) (2021-06-22)
|
19
|
+
|
20
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.1.0...v2.1.1)
|
21
|
+
|
22
|
+
**Fixed bugs:**
|
23
|
+
|
24
|
+
- \(PDK-1085\) Fail gracefully when no unit tests available [\#1096](https://github.com/puppetlabs/pdk/pull/1096) ([sanfrancrisko](https://github.com/sanfrancrisko))
|
25
|
+
- \(GH-1090\) Verify the changelog top most version matches the metadata version [\#1088](https://github.com/puppetlabs/pdk/pull/1088) ([carabasdaniel](https://github.com/carabasdaniel))
|
26
|
+
- \(GH-1083\) Bump childprocess to '~\> 4.0.0'; Disable @process.leader [\#1084](https://github.com/puppetlabs/pdk/pull/1084) ([sanfrancrisko](https://github.com/sanfrancrisko))
|
27
|
+
|
28
|
+
**Merged pull requests:**
|
29
|
+
|
30
|
+
- \(PDK-1041\) Use diff-lcs 1.4.4 [\#1091](https://github.com/puppetlabs/pdk/pull/1091) ([da-ar](https://github.com/da-ar))
|
31
|
+
- Update CODEOWNERS [\#1082](https://github.com/puppetlabs/pdk/pull/1082) ([jpogran](https://github.com/jpogran))
|
32
|
+
|
33
|
+
## [v2.1.0](https://github.com/puppetlabs/pdk/tree/v2.1.0) (2021-04-06)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.0.0...v2.1.0)
|
36
|
+
|
37
|
+
**Merged pull requests:**
|
38
|
+
|
39
|
+
- \(maint\) Mark stale issues [\#1028](https://github.com/puppetlabs/pdk/pull/1028) ([jpogran](https://github.com/jpogran))
|
40
|
+
- \(PF-2332\) Add `pdk env` subcommand [\#957](https://github.com/puppetlabs/pdk/pull/957) ([nkanderson](https://github.com/nkanderson))
|
41
|
+
- Docs: Install on macOS with brew [\#954](https://github.com/puppetlabs/pdk/pull/954) ([rwaffen](https://github.com/rwaffen))
|
42
|
+
- \(MAINT\) Bump version to 2.1.0.pre [\#952](https://github.com/puppetlabs/pdk/pull/952) ([scotje](https://github.com/scotje))
|
43
|
+
- \(MAINT\) Fixup some superfluous entries in the 2.0.0 release notes [\#951](https://github.com/puppetlabs/pdk/pull/951) ([scotje](https://github.com/scotje))
|
44
|
+
- \(Docs\) Update version number in welcome page [\#950](https://github.com/puppetlabs/pdk/pull/950) ([hestonhoffman](https://github.com/hestonhoffman))
|
45
|
+
- \(Docs\) Release notes edits [\#949](https://github.com/puppetlabs/pdk/pull/949) ([hestonhoffman](https://github.com/hestonhoffman))
|
46
|
+
## [v2.0.0](https://github.com/puppetlabs/pdk/tree/v2.0.0) (2021-02-24)
|
47
|
+
|
48
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.18.1...v2.0.0)
|
49
|
+
|
50
|
+
**Implemented enhancements:**
|
51
|
+
|
52
|
+
- Provide more context when forge upload fails [\#905](https://github.com/puppetlabs/pdk/issues/905)
|
53
|
+
- \(IAC-1438\) - Removal of Inappropriate Terminology [\#945](https://github.com/puppetlabs/pdk/pull/945) ([david22swan](https://github.com/david22swan))
|
54
|
+
- Remove pre-condition checks for RSAPI objects [\#943](https://github.com/puppetlabs/pdk/pull/943) ([DavidS](https://github.com/DavidS))
|
55
|
+
- Update lower puppet requirements bound when creating new modules [\#942](https://github.com/puppetlabs/pdk/pull/942) ([DavidS](https://github.com/DavidS))
|
56
|
+
- Allow Facter4 to be co-installed with PDK [\#941](https://github.com/puppetlabs/pdk/pull/941) ([GabrielNagy](https://github.com/GabrielNagy))
|
57
|
+
- Add ability to generate functions [\#932](https://github.com/puppetlabs/pdk/pull/932) ([logicminds](https://github.com/logicminds))
|
58
|
+
- \(GH-905\) Ensure release failure includes error message [\#929](https://github.com/puppetlabs/pdk/pull/929) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
59
|
+
- Adds AIX support when creating a new module [\#927](https://github.com/puppetlabs/pdk/pull/927) ([logicminds](https://github.com/logicminds))
|
60
|
+
- Add ability to generate new facts [\#921](https://github.com/puppetlabs/pdk/pull/921) ([logicminds](https://github.com/logicminds))
|
61
|
+
- Add forge token env [\#913](https://github.com/puppetlabs/pdk/pull/913) ([scotje](https://github.com/scotje))
|
62
|
+
- \(FORGE-339\) Omit .DS\_Store files from module builds [\#910](https://github.com/puppetlabs/pdk/pull/910) ([binford2k](https://github.com/binford2k))
|
63
|
+
- \(\#876\) Refactor text report output when validators are skipped [\#904](https://github.com/puppetlabs/pdk/pull/904) ([scotje](https://github.com/scotje))
|
64
|
+
|
65
|
+
**Fixed bugs:**
|
66
|
+
|
67
|
+
- puppet 7 dependency problems [\#931](https://github.com/puppetlabs/pdk/issues/931)
|
68
|
+
- PDK download fails with 404 for macOS [\#928](https://github.com/puppetlabs/pdk/issues/928)
|
69
|
+
- PDK does not support ruby 2.7 [\#914](https://github.com/puppetlabs/pdk/issues/914)
|
70
|
+
- The `pdk release prep` command cannot find the github\_changelog\_generator gem [\#902](https://github.com/puppetlabs/pdk/issues/902)
|
71
|
+
- \(PDK-1655\) pdk test unit fails when compiling spec tests on puppet 6.17 due to removal of default\_env [\#890](https://github.com/puppetlabs/pdk/issues/890)
|
72
|
+
- Unit tests fail with can't modify frozen String \(RuntimeError\) [\#886](https://github.com/puppetlabs/pdk/issues/886)
|
73
|
+
- `pdk validate` is missing a newline at the end, resulting in the shell prompt being printed on the same line [\#876](https://github.com/puppetlabs/pdk/issues/876)
|
74
|
+
|
75
|
+
## [v1.18.1](https://github.com/puppetlabs/pdk/tree/v1.18.1) (2020-07-17)
|
8
76
|
|
9
77
|
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.18.0...v1.18.1)
|
10
78
|
|
@@ -29,7 +97,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
29
97
|
- Warning from libhoney when running unit test with PDK 1.17 [\#875](https://github.com/puppetlabs/pdk/issues/875)
|
30
98
|
- 'pdk convert' of a module that's inside a control repo adds boilerplate to the control repo [\#874](https://github.com/puppetlabs/pdk/issues/874)
|
31
99
|
- GemNotFound error for public\_suffix-3.1.1 when using --add-tests [\#869](https://github.com/puppetlabs/pdk/issues/869)
|
32
|
-
- Scrollback of failed rspec tests in VS code is extremely limited [\#829](https://github.com/puppetlabs/pdk/issues/829)
|
33
100
|
- Running individual rspec tests on Windows requires escaping the path [\#828](https://github.com/puppetlabs/pdk/issues/828)
|
34
101
|
- Generated descriptions for certain test comparisons break JUnit output [\#821](https://github.com/puppetlabs/pdk/issues/821)
|
35
102
|
- Fix PDK release command module validation [\#880](https://github.com/puppetlabs/pdk/pull/880) ([carabasdaniel](https://github.com/carabasdaniel))
|
@@ -54,6 +121,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
54
121
|
- \(PDK-1615\) Add Ini File configuration support [\#856](https://github.com/puppetlabs/pdk/pull/856) ([glennsarti](https://github.com/glennsarti))
|
55
122
|
- \(PDK-1612\) Add PDK::Context and context detection [\#853](https://github.com/puppetlabs/pdk/pull/853) ([glennsarti](https://github.com/glennsarti))
|
56
123
|
- \(PDK-1607\)\(PDK-1608\) Implement system-level settings for PDK configuration [\#841](https://github.com/puppetlabs/pdk/pull/841) ([glennsarti](https://github.com/glennsarti))
|
124
|
+
- \(PDK-1557\) Detect Control Repositories [\#826](https://github.com/puppetlabs/pdk/pull/826) ([glennsarti](https://github.com/glennsarti))
|
57
125
|
|
58
126
|
**Fixed bugs:**
|
59
127
|
|
@@ -77,8 +145,8 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
77
145
|
- \(PDK-1545\) Include template-ref in module generation output [\#840](https://github.com/puppetlabs/pdk/pull/840) ([rodjek](https://github.com/rodjek))
|
78
146
|
- \(PDK-1587\) Reject paths with non-ASCII characters when building [\#832](https://github.com/puppetlabs/pdk/pull/832) ([rodjek](https://github.com/rodjek))
|
79
147
|
- \(PDK-1588\) Increase granularity of `pdk bundle` analytics [\#827](https://github.com/puppetlabs/pdk/pull/827) ([rodjek](https://github.com/rodjek))
|
80
|
-
- \(PDK-1557\) Detect Control Repositories [\#826](https://github.com/puppetlabs/pdk/pull/826) ([glennsarti](https://github.com/glennsarti))
|
81
148
|
- \(PDK-1556\) Use the module root when generating objects [\#824](https://github.com/puppetlabs/pdk/pull/824) ([glennsarti](https://github.com/glennsarti))
|
149
|
+
- \(PDK-1487\) Add --default-template flag to pdk convert [\#814](https://github.com/puppetlabs/pdk/pull/814) ([rodjek](https://github.com/rodjek))
|
82
150
|
|
83
151
|
**Fixed bugs:**
|
84
152
|
|
@@ -100,7 +168,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
100
168
|
**Implemented enhancements:**
|
101
169
|
|
102
170
|
- \(PDK-1488\) Inform user if updating a pinned module [\#816](https://github.com/puppetlabs/pdk/pull/816) ([rodjek](https://github.com/rodjek))
|
103
|
-
- \(PDK-1487\) Add --default-template flag to pdk convert [\#814](https://github.com/puppetlabs/pdk/pull/814) ([rodjek](https://github.com/rodjek))
|
104
171
|
- \(GH-808\) Implement pdk release prep and publish subcommands [\#813](https://github.com/puppetlabs/pdk/pull/813) ([glennsarti](https://github.com/glennsarti))
|
105
172
|
- \(GH-808\) Implement pdk release subcommand [\#809](https://github.com/puppetlabs/pdk/pull/809) ([glennsarti](https://github.com/glennsarti))
|
106
173
|
- \(PDK-1364\) Allow non-git template directories to be used [\#803](https://github.com/puppetlabs/pdk/pull/803) ([glennsarti](https://github.com/glennsarti))
|
@@ -244,7 +311,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
244
311
|
- \(maint\) Update beaker in package tests [\#695](https://github.com/puppetlabs/pdk/pull/695) ([rodjek](https://github.com/rodjek))
|
245
312
|
- Revert "Merge pull request \#666 from DavidS/fm-8081-pdk-new-transport" [\#693](https://github.com/puppetlabs/pdk/pull/693) ([DavidS](https://github.com/DavidS))
|
246
313
|
- \(maint\) Message and string fixes [\#676](https://github.com/puppetlabs/pdk/pull/676) ([DavidS](https://github.com/DavidS))
|
247
|
-
- \(PDK-1333\) command\_spec rake task [\#644](https://github.com/puppetlabs/pdk/pull/644) ([rodjek](https://github.com/rodjek))
|
248
314
|
|
249
315
|
## [v1.11.1](https://github.com/puppetlabs/pdk/tree/v1.11.1) (2019-07-01)
|
250
316
|
|
@@ -309,7 +375,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
309
375
|
- \(PDK-1335\) Add development note when on Windows [\#649](https://github.com/puppetlabs/pdk/pull/649) ([glennsarti](https://github.com/glennsarti))
|
310
376
|
- \(maint\) Allow developers to add additional gems [\#648](https://github.com/puppetlabs/pdk/pull/648) ([glennsarti](https://github.com/glennsarti))
|
311
377
|
- \(PDK-1167\) Validator should honor case sensitive of the file system [\#646](https://github.com/puppetlabs/pdk/pull/646) ([glennsarti](https://github.com/glennsarti))
|
312
|
-
- \(PDK-
|
378
|
+
- \(PDK-1333\) command\_spec rake task [\#644](https://github.com/puppetlabs/pdk/pull/644) ([rodjek](https://github.com/rodjek))
|
313
379
|
|
314
380
|
## [v1.10.0](https://github.com/puppetlabs/pdk/tree/v1.10.0) (2019-04-02)
|
315
381
|
|
@@ -321,6 +387,10 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
321
387
|
- \(PDK-1308\) Ensure PDK-written non-templated files have trailing newline [\#640](https://github.com/puppetlabs/pdk/pull/640) ([scotje](https://github.com/scotje))
|
322
388
|
- \(PDK-718\) Add --template-ref argument for upstream template repo tags [\#434](https://github.com/puppetlabs/pdk/pull/434) ([hunner](https://github.com/hunner))
|
323
389
|
|
390
|
+
**Fixed bugs:**
|
391
|
+
|
392
|
+
- \(PDK-1266\) Clear modulepath value when validating manifest syntax [\#629](https://github.com/puppetlabs/pdk/pull/629) ([rodjek](https://github.com/rodjek))
|
393
|
+
|
324
394
|
**Closed issues:**
|
325
395
|
|
326
396
|
- `pdk update` is not idempotent for deletion of CI config files [\#593](https://github.com/puppetlabs/pdk/issues/593)
|
@@ -333,6 +403,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
333
403
|
- \(PDK-1324\) Release 1.10.0 [\#650](https://github.com/puppetlabs/pdk/pull/650) ([rodjek](https://github.com/rodjek))
|
334
404
|
- \(maint\) Fix package specs for template-ref changes [\#647](https://github.com/puppetlabs/pdk/pull/647) ([rodjek](https://github.com/rodjek))
|
335
405
|
- \(maint\) Enforce LF line endings in Rubocop [\#645](https://github.com/puppetlabs/pdk/pull/645) ([glennsarti](https://github.com/glennsarti))
|
406
|
+
- \(PDK-1193\) Saves packaged template-url in metadata as a keyword [\#639](https://github.com/puppetlabs/pdk/pull/639) ([bmjen](https://github.com/bmjen))
|
336
407
|
- \(FM-7579, PDK-1236\) bump the version of CRI used [\#638](https://github.com/puppetlabs/pdk/pull/638) ([tphoney](https://github.com/tphoney))
|
337
408
|
- \(PDK-1294\) Update version post-release [\#637](https://github.com/puppetlabs/pdk/pull/637) ([bmjen](https://github.com/bmjen))
|
338
409
|
- \(PDK-1298\) acceptance:local test suite optimisation [\#633](https://github.com/puppetlabs/pdk/pull/633) ([rodjek](https://github.com/rodjek))
|
@@ -344,16 +415,15 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
344
415
|
**Fixed bugs:**
|
345
416
|
|
346
417
|
- \(IMAGES-1037\) Make sure our paths are used [\#630](https://github.com/puppetlabs/pdk/pull/630) ([mihaibuzgau](https://github.com/mihaibuzgau))
|
347
|
-
- \(PDK-1266\) Clear modulepath value when validating manifest syntax [\#629](https://github.com/puppetlabs/pdk/pull/629) ([rodjek](https://github.com/rodjek))
|
348
|
-
- \(PDK-1272\) Convert user/module module names to user-module [\#626](https://github.com/puppetlabs/pdk/pull/626) ([rodjek](https://github.com/rodjek))
|
349
418
|
- \(PDK-1276\) Skip non-file YAML validator targets [\#625](https://github.com/puppetlabs/pdk/pull/625) ([rodjek](https://github.com/rodjek))
|
350
|
-
- \(PDK-1273\)
|
419
|
+
- \(PDK-1273\) Allowlist Ruby symbols in YAML validator [\#624](https://github.com/puppetlabs/pdk/pull/624) ([rodjek](https://github.com/rodjek))
|
351
420
|
|
352
421
|
**Merged pull requests:**
|
353
422
|
|
354
423
|
- \(PDK-1289\) Release 1.9.1 [\#632](https://github.com/puppetlabs/pdk/pull/632) ([bmjen](https://github.com/bmjen))
|
355
424
|
- \(maint\) Pin parallel gem to 1.13.0 [\#631](https://github.com/puppetlabs/pdk/pull/631) ([rodjek](https://github.com/rodjek))
|
356
425
|
- \(PDK-1260\) Bump to 1.10.0.pre for new dev work [\#621](https://github.com/puppetlabs/pdk/pull/621) ([bmjen](https://github.com/bmjen))
|
426
|
+
- \(maint\) Fix package tests to remove hardcoding [\#613](https://github.com/puppetlabs/pdk/pull/613) ([bmjen](https://github.com/bmjen))
|
357
427
|
|
358
428
|
## [v1.9.0](https://github.com/puppetlabs/pdk/tree/v1.9.0) (2019-01-29)
|
359
429
|
|
@@ -365,6 +435,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
365
435
|
|
366
436
|
**Fixed bugs:**
|
367
437
|
|
438
|
+
- \(PDK-1272\) Convert user/module module names to user-module [\#626](https://github.com/puppetlabs/pdk/pull/626) ([rodjek](https://github.com/rodjek))
|
368
439
|
- \(PDK-914\) Adjust default\_template\_url validation to accept local dirs [\#606](https://github.com/puppetlabs/pdk/pull/606) ([rodjek](https://github.com/rodjek))
|
369
440
|
- \(PDK-1204\) pdk bundle execs in the context of the pwd [\#603](https://github.com/puppetlabs/pdk/pull/603) ([rodjek](https://github.com/rodjek))
|
370
441
|
|
@@ -380,7 +451,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
380
451
|
- \(maint\) Update hitimes pin to 1.3.0 for r2.1 compat [\#617](https://github.com/puppetlabs/pdk/pull/617) ([bmjen](https://github.com/bmjen))
|
381
452
|
- Release 1.9.0 [\#616](https://github.com/puppetlabs/pdk/pull/616) ([bmjen](https://github.com/bmjen))
|
382
453
|
- \(MAINT\) Configure Slack notifications for Travis [\#614](https://github.com/puppetlabs/pdk/pull/614) ([scotje](https://github.com/scotje))
|
383
|
-
- \(maint\) Fix package tests to remove hardcoding [\#613](https://github.com/puppetlabs/pdk/pull/613) ([bmjen](https://github.com/bmjen))
|
384
454
|
- \(MAINT\) Fix package acceptance tests to pass with any Ruby 2.4.x [\#611](https://github.com/puppetlabs/pdk/pull/611) ([scotje](https://github.com/scotje))
|
385
455
|
- \(MAINT\) Bump default packaged ruby version to 2.4.5 [\#608](https://github.com/puppetlabs/pdk/pull/608) ([scotje](https://github.com/scotje))
|
386
456
|
- \(PDK-1202\) Pass TemplateDir object through to TemplateFile [\#605](https://github.com/puppetlabs/pdk/pull/605) ([rodjek](https://github.com/rodjek))
|
@@ -999,6 +1069,7 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
999
1069
|
- Validate fails on existing module [\#158](https://github.com/puppetlabs/pdk/issues/158)
|
1000
1070
|
- \(\#158\) \(\#166\) Resolve issue loading bundler from gem installs [\#170](https://github.com/puppetlabs/pdk/pull/170) ([scotje](https://github.com/scotje))
|
1001
1071
|
- \(SDK-319\) force usage of our ruby [\#168](https://github.com/puppetlabs/pdk/pull/168) ([DavidS](https://github.com/DavidS))
|
1072
|
+
- \(FIXUP\) Add missing newlines in new module interview prompts [\#161](https://github.com/puppetlabs/pdk/pull/161) ([scotje](https://github.com/scotje))
|
1002
1073
|
|
1003
1074
|
**Closed issues:**
|
1004
1075
|
|
@@ -1031,7 +1102,6 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
|
|
1031
1102
|
**Fixed bugs:**
|
1032
1103
|
|
1033
1104
|
- Can't create module if new module fails to get login [\#157](https://github.com/puppetlabs/pdk/issues/157)
|
1034
|
-
- \(FIXUP\) Add missing newlines in new module interview prompts [\#161](https://github.com/puppetlabs/pdk/pull/161) ([scotje](https://github.com/scotje))
|
1035
1105
|
- Use default username when Etc.getlogin fails [\#160](https://github.com/puppetlabs/pdk/pull/160) ([austb](https://github.com/austb))
|
1036
1106
|
|
1037
1107
|
**Merged pull requests:**
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# pdk [![Build Status](https://travis-ci.org/puppetlabs/pdk.svg?branch=
|
1
|
+
# pdk [![Build Status](https://travis-ci.org/puppetlabs/pdk.svg?branch=main)](https://travis-ci.org/puppetlabs/pdk) [![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/x70e2fqllbaootpd?svg=true)](https://ci.appveyor.com/project/puppetlabs/pdk) [![Coverage Status](https://coveralls.io/repos/github/puppetlabs/pdk/badge.svg?branch=main)](https://coveralls.io/github/puppetlabs/pdk?branch=main)
|
2
2
|
|
3
3
|
* [Installation](#installation)
|
4
4
|
* [Basic usage](#basic-usage)
|
data/lib/pdk/cli.rb
CHANGED
@@ -5,7 +5,10 @@ require 'pdk/cli/errors'
|
|
5
5
|
|
6
6
|
module TTY
|
7
7
|
autoload :Prompt, 'tty/prompt'
|
8
|
-
|
8
|
+
|
9
|
+
class Prompt
|
10
|
+
autoload :Test, 'tty/prompt/test'
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
class Cri::Command::CriExitException
|
@@ -156,6 +159,7 @@ module PDK::CLI
|
|
156
159
|
require 'pdk/cli/build'
|
157
160
|
require 'pdk/cli/config'
|
158
161
|
require 'pdk/cli/convert'
|
162
|
+
require 'pdk/cli/env'
|
159
163
|
require 'pdk/cli/get'
|
160
164
|
require 'pdk/cli/new'
|
161
165
|
require 'pdk/cli/set'
|
data/lib/pdk/cli/env.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module PDK::CLI
|
2
|
+
@env_cmd = @base_cmd.define_command do
|
3
|
+
name 'env'
|
4
|
+
usage _('env')
|
5
|
+
summary _('(Experimental) Output environment variables for specific Puppet context')
|
6
|
+
description _(<<-EOF
|
7
|
+
[experimental] Aids in setting a CLI context for a specified version of Puppet by outputting export commands for necessary environment variables.
|
8
|
+
EOF
|
9
|
+
)
|
10
|
+
|
11
|
+
PDK::CLI.puppet_version_options(self)
|
12
|
+
PDK::CLI.puppet_dev_option(self)
|
13
|
+
|
14
|
+
run do |opts, _args, _cmd|
|
15
|
+
require 'pdk/util'
|
16
|
+
require 'pdk/util/ruby_version'
|
17
|
+
|
18
|
+
PDK::CLI::Util.validate_puppet_version_opts(opts)
|
19
|
+
|
20
|
+
PDK::CLI::Util.analytics_screen_view('env')
|
21
|
+
|
22
|
+
# Ensure that the correct Ruby is activated before running command.
|
23
|
+
puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
|
24
|
+
PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
|
25
|
+
|
26
|
+
resolved_env = {
|
27
|
+
'PDK_RESOLVED_PUPPET_VERSION' => puppet_env[:gemset][:puppet],
|
28
|
+
'PDK_RESOLVED_RUBY_VERSION' => puppet_env[:ruby_version],
|
29
|
+
}
|
30
|
+
|
31
|
+
resolved_env['GEM_HOME'] = PDK::Util::RubyVersion.gem_home
|
32
|
+
gem_path = PDK::Util::RubyVersion.gem_path
|
33
|
+
resolved_env['GEM_PATH'] = gem_path.empty? ? resolved_env['GEM_HOME'] : gem_path
|
34
|
+
|
35
|
+
# Make sure invocation of Ruby prefers our private installation.
|
36
|
+
package_binpath = PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil
|
37
|
+
|
38
|
+
resolved_env['PATH'] = [
|
39
|
+
PDK::Util::RubyVersion.bin_path,
|
40
|
+
File.join(resolved_env['GEM_HOME'], 'bin'),
|
41
|
+
PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path_raw| File.join(gem_path_raw, 'bin') },
|
42
|
+
package_binpath,
|
43
|
+
PDK::Util::Env['PATH'],
|
44
|
+
].compact.flatten.join(File::PATH_SEPARATOR)
|
45
|
+
|
46
|
+
resolved_env.each do |var, val|
|
47
|
+
puts "export #{var}=\"#{val}\""
|
48
|
+
end
|
49
|
+
exit 0
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/pdk/cli/exec/command.rb
CHANGED
@@ -27,7 +27,17 @@ module PDK
|
|
27
27
|
@argv = argv
|
28
28
|
|
29
29
|
@process = ChildProcess.build(*@argv)
|
30
|
-
|
30
|
+
# https://github.com/puppetlabs/pdk/issues/1083:
|
31
|
+
# When @process.leader is set, childprocess will set the CREATE_BREAKAWAY_FROM_JOB
|
32
|
+
# and JOB_OBJECT_LIMIT_BREAKAWAY_OK flags in the Win32 API calls. This will cause
|
33
|
+
# issues on systems > Windows 7 / Server 2008, if the JOB_OBJECT_LIMIT_BREAKAWAY_OK
|
34
|
+
# flag is set and the Task Scheduler is trying to kick off a job, it can sometimes
|
35
|
+
# result in ACCESS_DENIED being returned by the Win32 API, depending on the permission
|
36
|
+
# levels / user account this user.
|
37
|
+
# The resolution for pdk/issues/1083 is to ensure @process.leader is not set.
|
38
|
+
# This will potentially cause issues on older Windows systems, in which case we may
|
39
|
+
# need to revisit and conditionally set this param depending on what OS we're on
|
40
|
+
# @process.leader = true
|
31
41
|
|
32
42
|
@stdout = Tempfile.new('stdout', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
|
33
43
|
@stderr = Tempfile.new('stderr', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
|
data/lib/pdk/cli/new.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module PDK::CLI
|
2
|
+
@new_fact_cmd = @new_cmd.define_command do
|
3
|
+
name 'fact'
|
4
|
+
usage _('fact [options] <name>')
|
5
|
+
summary _('Create a new custom fact named <name> using given options')
|
6
|
+
|
7
|
+
run do |opts, args, _cmd|
|
8
|
+
PDK::CLI::Util.ensure_in_module!
|
9
|
+
|
10
|
+
fact_name = args[0]
|
11
|
+
|
12
|
+
if fact_name.nil? || fact_name.empty?
|
13
|
+
puts command.help
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
unless Util::OptionValidator.valid_fact_name?(fact_name)
|
18
|
+
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid fact name") % { name: fact_name }
|
19
|
+
end
|
20
|
+
|
21
|
+
PDK::CLI::Util.analytics_screen_view('new_fact', opts)
|
22
|
+
|
23
|
+
require 'pdk/generate/fact'
|
24
|
+
|
25
|
+
updates = PDK::Generate::Fact.new(PDK.context, fact_name, opts).run
|
26
|
+
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module PDK::CLI
|
2
|
+
@new_function_cmd = @new_cmd.define_command do
|
3
|
+
name 'function'
|
4
|
+
usage _('function [options] <name>')
|
5
|
+
summary _('Create a new function named <name> using given options')
|
6
|
+
option :t, :type, _('The function type, (native or v4)'), argument: :required, default: 'native'
|
7
|
+
|
8
|
+
run do |opts, args, _cmd|
|
9
|
+
PDK::CLI::Util.ensure_in_module!
|
10
|
+
|
11
|
+
function_name = args[0]
|
12
|
+
|
13
|
+
if function_name.nil? || function_name.empty?
|
14
|
+
puts command.help
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
unless Util::OptionValidator.valid_function_name?(function_name)
|
19
|
+
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid function name") % { name: function_name }
|
20
|
+
end
|
21
|
+
|
22
|
+
PDK::CLI::Util.analytics_screen_view('new_function', opts)
|
23
|
+
|
24
|
+
require 'pdk/generate/function'
|
25
|
+
updates = PDK::Generate::Function.new(PDK.context, function_name, opts).run
|
26
|
+
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/pdk/cli/release.rb
CHANGED
@@ -22,7 +22,8 @@ module PDK::CLI
|
|
22
22
|
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
23
23
|
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
24
24
|
|
25
|
-
option nil, :'forge-token', _('Set Forge API token.'),
|
25
|
+
option nil, :'forge-token', _('Set Forge API token.'),
|
26
|
+
argument: :optional
|
26
27
|
|
27
28
|
option nil, :version, _('Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.'),
|
28
29
|
argument: :required
|
@@ -145,6 +146,7 @@ module PDK::CLI
|
|
145
146
|
opts[:'skip-changelog'] = !answers['changelog']
|
146
147
|
opts[:'skip-dependency'] = !answers['dependency']
|
147
148
|
opts[:'skip-documentation'] = !answers['documentation']
|
149
|
+
opts[:'skip-publish'] = !answers['publish']
|
148
150
|
|
149
151
|
prepare_version_interview(prompt, opts) if answers['setversion']
|
150
152
|
|
@@ -11,7 +11,7 @@ module PDK::CLI
|
|
11
11
|
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
12
12
|
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
13
13
|
|
14
|
-
option nil, :'forge-token', _('Set Forge API token
|
14
|
+
option nil, :'forge-token', _('Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)'), argument: :required
|
15
15
|
|
16
16
|
run do |opts, _args, cmd|
|
17
17
|
# Make sure build is being run in a valid module directory with a metadata.json
|
@@ -27,6 +27,16 @@ module PDK::CLI
|
|
27
27
|
opts[:'skip-build'] = true
|
28
28
|
opts[:'skip-versionset'] = true
|
29
29
|
opts[:force] = true unless PDK::CLI::Util.interactive?
|
30
|
+
opts[:'forge-token'] ||= PDK::Util::Env['PDK_FORGE_TOKEN']
|
31
|
+
|
32
|
+
if opts[:'forge-token'].nil? || opts[:'forge-token'].empty?
|
33
|
+
PDK.logger.error _(
|
34
|
+
'You must supply a Forge API token either via `--forge-token` option ' \
|
35
|
+
'or PDK_FORGE_TOKEN environment variable.',
|
36
|
+
)
|
37
|
+
|
38
|
+
exit 1
|
39
|
+
end
|
30
40
|
|
31
41
|
Release.prepare_publish_interview(TTY::Prompt.new(help_color: :cyan), opts) unless opts[:force]
|
32
42
|
|
@@ -8,6 +8,11 @@ module PDK
|
|
8
8
|
(list =~ %r{^[\w\-]+(?:,[\w\-]+)+$}) ? true : false
|
9
9
|
end
|
10
10
|
|
11
|
+
# @return [Boolean] true if the fact name is valid
|
12
|
+
def self.valid_fact_name?(name)
|
13
|
+
name.length > 1
|
14
|
+
end
|
15
|
+
|
11
16
|
def self.enum(val, valid_entries, _options = {})
|
12
17
|
vals = val.is_a?(Array) ? val : [val]
|
13
18
|
invalid_entries = vals.reject { |e| valid_entries.include?(e) }
|
@@ -41,6 +46,7 @@ module PDK
|
|
41
46
|
|
42
47
|
!(string =~ %r{\A([a-z][a-z0-9_]*)(::[a-z][a-z0-9_]*)*\Z}).nil?
|
43
48
|
end
|
49
|
+
singleton_class.send(:alias_method, :valid_function_name?, :valid_namespace?)
|
44
50
|
|
45
51
|
singleton_class.send(:alias_method, :valid_class_name?, :valid_namespace?)
|
46
52
|
singleton_class.send(:alias_method, :valid_defined_type_name?, :valid_namespace?)
|
data/lib/pdk/config.rb
CHANGED
@@ -94,6 +94,12 @@ module PDK
|
|
94
94
|
if context.is_a?(PDK::Context::ControlRepo)
|
95
95
|
mount :environment, PDK::ControlRepo.environment_conf_as_config(File.join(context.root_path, 'environment.conf'))
|
96
96
|
end
|
97
|
+
|
98
|
+
mount :validate, PDK::Config::YAML.new('validate', file: File.join(context.root_path, 'pdk.yaml'), persistent_defaults: true) do
|
99
|
+
setting 'ignore' do
|
100
|
+
default_to { [] }
|
101
|
+
end
|
102
|
+
end
|
97
103
|
end
|
98
104
|
end
|
99
105
|
|
data/lib/pdk/generate.rb
CHANGED
@@ -7,7 +7,6 @@ module PDK
|
|
7
7
|
autoload :Provider, 'pdk/generate/provider'
|
8
8
|
autoload :PuppetClass, 'pdk/generate/puppet_class'
|
9
9
|
autoload :PuppetObject, 'pdk/generate/puppet_object'
|
10
|
-
autoload :ResourceAPIObject, 'pdk/generate/resource_api_object'
|
11
10
|
autoload :Task, 'pdk/generate/task'
|
12
11
|
autoload :Transport, 'pdk/generate/transport'
|
13
12
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pdk'
|
2
|
+
|
3
|
+
module PDK
|
4
|
+
module Generate
|
5
|
+
class Fact < PuppetObject
|
6
|
+
def friendly_name
|
7
|
+
'Custom Fact'.freeze
|
8
|
+
end
|
9
|
+
|
10
|
+
def template_files
|
11
|
+
files = {
|
12
|
+
'fact_spec.erb' => File.join('spec', 'unit', 'facter', object_name) + '_spec.rb',
|
13
|
+
}
|
14
|
+
return files if spec_only?
|
15
|
+
files.merge(
|
16
|
+
'fact.erb' => File.join('lib', 'facter', object_name) + '.rb',
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def template_data
|
21
|
+
{ name: object_name }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'pdk'
|
2
|
+
|
3
|
+
module PDK
|
4
|
+
module Generate
|
5
|
+
class Function < PuppetObject
|
6
|
+
def initialize(*_args)
|
7
|
+
super
|
8
|
+
object_name_parts = @object_name.split('::')
|
9
|
+
|
10
|
+
@object_name = if object_name_parts.first == module_name
|
11
|
+
object_name
|
12
|
+
else
|
13
|
+
[module_name, object_name].join('::')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def friendly_name
|
18
|
+
'Function'.freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
def template_files
|
22
|
+
# Calculate the function tests name
|
23
|
+
func_name_parts = object_name.split('::')
|
24
|
+
# Drop the module name if the object name contains multiple parts
|
25
|
+
func_name_parts.delete_at(0) if func_name_parts.length > 1
|
26
|
+
files = {
|
27
|
+
File.join('functions', 'function_spec.erb') => File.join('spec', 'functions', *func_name_parts) + '_spec.rb',
|
28
|
+
}
|
29
|
+
return files if spec_only?
|
30
|
+
func_name_parts = object_name.split('::')[1..-1]
|
31
|
+
template_file = File.join('functions', "#{options[:type]}_function.erb")
|
32
|
+
|
33
|
+
files[template_file] = if options[:type].eql?('v4')
|
34
|
+
File.join('lib', 'puppet', 'functions', module_name, *func_name_parts) + '.rb'
|
35
|
+
else
|
36
|
+
File.join('functions', *func_name_parts) + '.pp'
|
37
|
+
end
|
38
|
+
files
|
39
|
+
end
|
40
|
+
|
41
|
+
def template_data
|
42
|
+
func_name = object_name.split('::').last
|
43
|
+
namespace = object_name.split('::')[0...-1].join('::')
|
44
|
+
{ name: object_name, func_name: func_name, namespace: namespace }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/pdk/module.rb
CHANGED
data/lib/pdk/module/metadata.rb
CHANGED
@@ -27,7 +27,7 @@ module PDK
|
|
27
27
|
'Debian based Linux' => [
|
28
28
|
{
|
29
29
|
'operatingsystem' => 'Debian',
|
30
|
-
'operatingsystemrelease' => ['
|
30
|
+
'operatingsystemrelease' => ['10'],
|
31
31
|
},
|
32
32
|
{
|
33
33
|
'operatingsystem' => 'Ubuntu',
|
@@ -54,6 +54,10 @@ module PDK
|
|
54
54
|
'operatingsystem' => 'windows',
|
55
55
|
'operatingsystemrelease' => %w[2019 10],
|
56
56
|
},
|
57
|
+
'AIX' => {
|
58
|
+
'operatingsystem' => 'AIX',
|
59
|
+
'operatingsystemrelease' => %w[6.1 7.1 7.2],
|
60
|
+
},
|
57
61
|
}.freeze
|
58
62
|
|
59
63
|
DEFAULT_OPERATING_SYSTEMS = [
|
@@ -77,7 +81,7 @@ module PDK
|
|
77
81
|
OPERATING_SYSTEMS[os_name]
|
78
82
|
}.flatten,
|
79
83
|
'requirements' => [
|
80
|
-
{ 'name' => 'puppet', 'version_requirement' => '>=
|
84
|
+
{ 'name' => 'puppet', 'version_requirement' => '>= 6.21.0 < 8.0.0' },
|
81
85
|
],
|
82
86
|
}.freeze
|
83
87
|
|
data/lib/pdk/module/release.rb
CHANGED
@@ -65,6 +65,12 @@ module PDK
|
|
65
65
|
|
66
66
|
# Update the changelog with the correct version
|
67
67
|
PDK::Util::ChangelogGenerator.generate_changelog unless skip_changelog?
|
68
|
+
|
69
|
+
# Check if the versions match
|
70
|
+
latest_version = PDK::Util::ChangelogGenerator.latest_version
|
71
|
+
unless latest_version
|
72
|
+
raise PDK::CLI::ExitWithError, _('%{new_version} does not match %{latest_version}') % { new_version: new_version, latest_version: latest_version } if new_version != latest_version
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
run_documentation(options) unless skip_documentation?
|
@@ -163,7 +169,7 @@ module PDK
|
|
163
169
|
http.request(request)
|
164
170
|
end
|
165
171
|
|
166
|
-
raise PDK::CLI::ExitWithError, _('Error uploading to Puppet Forge: %{result}') % { result: response } unless response.is_a?(Net::HTTPSuccess)
|
172
|
+
raise PDK::CLI::ExitWithError, _('Error uploading to Puppet Forge: %{result}') % { result: response.body } unless response.is_a?(Net::HTTPSuccess)
|
167
173
|
PDK.logger.info _('Publish to Forge was successful')
|
168
174
|
end
|
169
175
|
|
data/lib/pdk/module/update.rb
CHANGED
data/lib/pdk/report.rb
CHANGED
@@ -104,7 +104,7 @@ module PDK
|
|
104
104
|
if event.rspec_puppet_coverage?
|
105
105
|
coverage_report = event.to_text
|
106
106
|
else
|
107
|
-
report << event.to_text unless event.pass?
|
107
|
+
report << event.to_text unless event.pass? || event.skipped?
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -113,8 +113,8 @@ module PDK
|
|
113
113
|
|
114
114
|
if target.is_a?(String)
|
115
115
|
PDK::Util::Filesystem.write_file(target, report.join("\n"))
|
116
|
-
|
117
|
-
target << report.join("\n")
|
116
|
+
elsif !report.empty?
|
117
|
+
target << report.join("\n") << "\n"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
data/lib/pdk/report/event.rb
CHANGED
@@ -111,8 +111,8 @@ module PDK
|
|
111
111
|
location = nil if location.empty?
|
112
112
|
|
113
113
|
# TODO: maybe add trace
|
114
|
-
header = [severity, source, location, message].compact.join(': ')
|
115
114
|
if source == 'rspec'
|
115
|
+
header = [severity, source, location, message].compact.join(': ')
|
116
116
|
result = [header, " #{test}"]
|
117
117
|
context = context_lines
|
118
118
|
unless context.nil?
|
@@ -123,7 +123,13 @@ module PDK
|
|
123
123
|
|
124
124
|
result.compact.join("\n")
|
125
125
|
else
|
126
|
-
|
126
|
+
output = ['pdk']
|
127
|
+
output << "(#{severity.upcase}):" unless severity.nil?
|
128
|
+
output << "#{source}:" unless source.nil?
|
129
|
+
output << message unless message.nil?
|
130
|
+
output << "(#{location})" unless location.nil?
|
131
|
+
|
132
|
+
output.join(' ')
|
127
133
|
end
|
128
134
|
end
|
129
135
|
|
data/lib/pdk/tests/unit.rb
CHANGED
@@ -139,7 +139,7 @@ module PDK
|
|
139
139
|
|
140
140
|
example_results = {
|
141
141
|
# Only possibilities are passed, failed, pending:
|
142
|
-
# https://github.com/rspec/rspec-core/blob/
|
142
|
+
# https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/example.rb#L548
|
143
143
|
'passed' => [],
|
144
144
|
'failed' => [],
|
145
145
|
'pending' => [],
|
@@ -183,6 +183,8 @@ module PDK
|
|
183
183
|
end
|
184
184
|
|
185
185
|
def self.merge_json_results(json_data)
|
186
|
+
require 'set'
|
187
|
+
|
186
188
|
merged_json_result = {}
|
187
189
|
|
188
190
|
# Merge messages
|
data/lib/pdk/util/bundler.rb
CHANGED
@@ -44,7 +44,7 @@ module PDK
|
|
44
44
|
# If there are missing dependencies after updating the lockfile, let `bundle install`
|
45
45
|
# go out and get them. If the specified puppet gem version points to a remote location
|
46
46
|
# or local filepath, then run bundle install as well.
|
47
|
-
if !bundle.installed? || (gem_overrides[:puppet] && gem_overrides[:puppet].start_with?('file://', 'git://', 'https://'))
|
47
|
+
if !bundle.installed?(gem_overrides) || (gem_overrides[:puppet] && gem_overrides[:puppet].start_with?('file://', 'git://', 'https://'))
|
48
48
|
bundle.install!(gem_overrides)
|
49
49
|
end
|
50
50
|
|
@@ -9,11 +9,15 @@ module PDK
|
|
9
9
|
|
10
10
|
# Raises if the github_changelog_generator is not available
|
11
11
|
def self.github_changelog_generator_available!
|
12
|
-
|
13
|
-
|
12
|
+
check_command = PDK::CLI::Exec::InteractiveCommand.new(PDK::CLI::Exec.bundle_bin, 'show', 'github_changelog_generator')
|
13
|
+
check_command.context = :module
|
14
|
+
|
15
|
+
result = check_command.execute!
|
16
|
+
|
17
|
+
return if result[:exit_code].zero?
|
14
18
|
|
15
19
|
raise PDK::CLI::ExitWithError, _(
|
16
|
-
'Unable to generate the changelog as the %{gem} gem is not
|
20
|
+
'Unable to generate the changelog as the %{gem} gem is not included in this module\'s Gemfile',
|
17
21
|
) % { gem: GEM }
|
18
22
|
end
|
19
23
|
|
@@ -106,6 +110,19 @@ module PDK
|
|
106
110
|
version.join('.')
|
107
111
|
end
|
108
112
|
|
113
|
+
# Returns the top most version from the CHANGELOG file
|
114
|
+
def self.latest_version
|
115
|
+
latest = nil
|
116
|
+
changelog_content.each_line do |line|
|
117
|
+
line.strip!
|
118
|
+
if line.start_with?('## [')
|
119
|
+
latest = line[line.index('[') + 1..line.index(']') - 1].delete('v')
|
120
|
+
break # stops after the top version is extracted
|
121
|
+
end
|
122
|
+
end
|
123
|
+
latest
|
124
|
+
end
|
125
|
+
|
109
126
|
def self.changelog_file
|
110
127
|
# Default Changelog file is CHANGELOG.md, but also search for the .MD prefix as well.
|
111
128
|
@changelog_file ||= ['CHANGELOG.md', 'CHANGELOG.MD'].map { |file| PDK::Util::Filesystem.expand_path(file) }.find { |path| PDK::Util::Filesystem.file?(path) }
|
data/lib/pdk/util/json_finder.rb
CHANGED
@@ -17,7 +17,7 @@ module PDK
|
|
17
17
|
|
18
18
|
PE_VERSIONS_URL = 'https://forgeapi.puppet.com/private/versions/pe'.freeze
|
19
19
|
DEFAULT_PUPPET_DEV_URL = 'https://github.com/puppetlabs/puppet'.freeze
|
20
|
-
DEFAULT_PUPPET_DEV_BRANCH = '
|
20
|
+
DEFAULT_PUPPET_DEV_BRANCH = 'main'.freeze
|
21
21
|
|
22
22
|
def puppet_dev_env
|
23
23
|
require 'pdk/util/ruby_version'
|
@@ -80,7 +80,7 @@ module PDK
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# Reset local repo to latest
|
83
|
-
reset_result = PDK::Util::Git.git('-C', puppet_dev_path, 'reset', '--hard',
|
83
|
+
reset_result = PDK::Util::Git.git('-C', puppet_dev_path, 'reset', '--hard', "origin/#{DEFAULT_PUPPET_DEV_BRANCH}")
|
84
84
|
|
85
85
|
@puppet_dev_fetched = true
|
86
86
|
return if reset_result[:exit_code].zero?
|
@@ -60,7 +60,11 @@ module PDK
|
|
60
60
|
#
|
61
61
|
# PDK::Util::PuppetVersion.find_gem_for('5.5.10')[:ruby_version]
|
62
62
|
#
|
63
|
-
|
63
|
+
# For using the latest puppet gem:
|
64
|
+
# PDK::Util::PuppetVersion.latest_available[:ruby_version]
|
65
|
+
#
|
66
|
+
# Temporarily lock to Ruby 2.5.x as default until 2.7.x ecosystem is sorted
|
67
|
+
versions.keys.detect { |v| v =~ %r{^2\.5} }
|
64
68
|
else
|
65
69
|
# TODO: may not be a safe assumption that highest available version should be default
|
66
70
|
# WARNING Do NOT use PDK::Util::PuppetVersion.*** methods as it can recurse into this
|
@@ -26,13 +26,13 @@ module PDK
|
|
26
26
|
#
|
27
27
|
# file:///c:/foo (git clone location)
|
28
28
|
# c:/foo (shell paths)
|
29
|
-
# file:///c:/foo#
|
30
|
-
# c:/foo#
|
29
|
+
# file:///c:/foo#main (only for metadata)
|
30
|
+
# c:/foo#main (only for metadata)
|
31
31
|
#
|
32
32
|
# non output formats:
|
33
33
|
#
|
34
34
|
# /c:/foo (internal use only)
|
35
|
-
# /c:/foo#
|
35
|
+
# /c:/foo#main (internal use only)
|
36
36
|
#
|
37
37
|
def initialize(opts_or_uri)
|
38
38
|
require 'addressable'
|
@@ -241,11 +241,11 @@ module PDK
|
|
241
241
|
require 'pdk/util'
|
242
242
|
require 'pdk/version'
|
243
243
|
|
244
|
-
return '
|
244
|
+
return 'main' if PDK::Util.development_mode?
|
245
245
|
return PDK::TEMPLATE_REF if uri.nil?
|
246
246
|
|
247
247
|
uri = new(uri) unless uri.is_a?(self)
|
248
|
-
uri.default? ? PDK::TEMPLATE_REF : '
|
248
|
+
uri.default? ? PDK::TEMPLATE_REF : 'main'
|
249
249
|
end
|
250
250
|
|
251
251
|
# @returns Addressable::URI
|
@@ -55,8 +55,7 @@ module PDK
|
|
55
55
|
uri = URI.parse(url)
|
56
56
|
http = Net::HTTP.new(uri.host, uri.port)
|
57
57
|
http.use_ssl = true
|
58
|
-
# TODO: Get rid of this
|
59
|
-
# https://github.com/glennsarti/dev-tools/blob/master/RubyCerts.ps1
|
58
|
+
# TODO: Get rid of this
|
60
59
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if Gem.win_platform?
|
61
60
|
request = Net::HTTP::Get.new(uri.request_uri)
|
62
61
|
response = http.request(request)
|
@@ -86,7 +86,12 @@ module PDK
|
|
86
86
|
ignore_list = ignore_pathspec
|
87
87
|
target_list = target_list.reject { |file| ignore_list.match(file) }
|
88
88
|
|
89
|
-
|
89
|
+
if target_list.flatten.empty?
|
90
|
+
PDK.logger.info(_('Validator \'%{validator}\' skipped for \'%{target}\'. No files matching \'%{pattern}\' found to validate.') % { validator: name, target: target, pattern: pattern })
|
91
|
+
|
92
|
+
skipped << target
|
93
|
+
end
|
94
|
+
|
90
95
|
target_list
|
91
96
|
elsif PDK::Util::Filesystem.file?(target)
|
92
97
|
if Array(pattern).include? target
|
@@ -208,6 +213,14 @@ module PDK
|
|
208
213
|
end
|
209
214
|
end
|
210
215
|
|
216
|
+
# block will always be [] because it is intialized in config
|
217
|
+
ignore_files = PDK.config.get_within_scopes('validate.ignore')
|
218
|
+
unless ignore_files.nil? || ignore_files.empty?
|
219
|
+
Array(ignore_files).each do |pattern|
|
220
|
+
ignore_pathspec.add(pattern)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
211
224
|
ignore_pathspec
|
212
225
|
end
|
213
226
|
end
|
@@ -49,7 +49,7 @@ module PDK
|
|
49
49
|
# Need to set the JSON Parser and State Generator to the Native one to be
|
50
50
|
# compatible with the multi_json adapter.
|
51
51
|
JSON.parser = JSON::Ext::Parser if defined?(JSON::Ext::Parser)
|
52
|
-
JSON.generator = JSON::Ext::Generator
|
52
|
+
JSON.generator = JSON::Ext::Generator if defined?(JSON::Ext::Generator)
|
53
53
|
|
54
54
|
begin
|
55
55
|
errors = JSON::Validator.fully_validate(schema_file, PDK::Util::Filesystem.read_file(target)) || []
|
@@ -4,7 +4,7 @@ module PDK
|
|
4
4
|
module Validate
|
5
5
|
module YAML
|
6
6
|
class YAMLSyntaxValidator < InternalRubyValidator
|
7
|
-
|
7
|
+
YAML_ALLOWLISTED_CLASSES = [Symbol].freeze
|
8
8
|
|
9
9
|
def ignore_dotfiles
|
10
10
|
false
|
@@ -53,7 +53,7 @@ module PDK
|
|
53
53
|
end
|
54
54
|
|
55
55
|
begin
|
56
|
-
::YAML.safe_load(PDK::Util::Filesystem.read_file(target),
|
56
|
+
::YAML.safe_load(PDK::Util::Filesystem.read_file(target), YAML_ALLOWLISTED_CLASSES, [], true)
|
57
57
|
|
58
58
|
report.add_event(
|
59
59
|
file: target,
|
data/lib/pdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 4.0.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 4.0.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cri
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,16 +62,22 @@ dependencies:
|
|
62
62
|
name: diff-lcs
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 1.4.4
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.5'
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
|
-
- -
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.4
|
78
|
+
- - "<"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '1.
|
80
|
+
version: '1.5'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: ffi
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,14 +118,14 @@ dependencies:
|
|
112
118
|
requirements:
|
113
119
|
- - '='
|
114
120
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
121
|
+
version: 2.0.0
|
116
122
|
type: :runtime
|
117
123
|
prerelease: false
|
118
124
|
version_requirements: !ruby/object:Gem::Requirement
|
119
125
|
requirements:
|
120
126
|
- - '='
|
121
127
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
128
|
+
version: 2.0.0
|
123
129
|
- !ruby/object:Gem::Dependency
|
124
130
|
name: json-schema
|
125
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,14 +188,14 @@ dependencies:
|
|
182
188
|
requirements:
|
183
189
|
- - "~>"
|
184
190
|
- !ruby/object:Gem::Version
|
185
|
-
version: '0.
|
191
|
+
version: '0.22'
|
186
192
|
type: :runtime
|
187
193
|
prerelease: false
|
188
194
|
version_requirements: !ruby/object:Gem::Requirement
|
189
195
|
requirements:
|
190
196
|
- - "~>"
|
191
197
|
- !ruby/object:Gem::Version
|
192
|
-
version: '0.
|
198
|
+
version: '0.22'
|
193
199
|
- !ruby/object:Gem::Dependency
|
194
200
|
name: tty-spinner
|
195
201
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,16 +242,22 @@ dependencies:
|
|
236
242
|
name: facter
|
237
243
|
requirement: !ruby/object:Gem::Requirement
|
238
244
|
requirements:
|
239
|
-
- - "
|
245
|
+
- - ">="
|
240
246
|
- !ruby/object:Gem::Version
|
241
247
|
version: 2.5.1
|
248
|
+
- - "<"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 5.0.0
|
242
251
|
type: :runtime
|
243
252
|
prerelease: false
|
244
253
|
version_requirements: !ruby/object:Gem::Requirement
|
245
254
|
requirements:
|
246
|
-
- - "
|
255
|
+
- - ">="
|
247
256
|
- !ruby/object:Gem::Version
|
248
257
|
version: 2.5.1
|
258
|
+
- - "<"
|
259
|
+
- !ruby/object:Gem::Version
|
260
|
+
version: 5.0.0
|
249
261
|
- !ruby/object:Gem::Dependency
|
250
262
|
name: httpclient
|
251
263
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,6 +312,7 @@ files:
|
|
300
312
|
- lib/pdk/cli/config/get.rb
|
301
313
|
- lib/pdk/cli/console.rb
|
302
314
|
- lib/pdk/cli/convert.rb
|
315
|
+
- lib/pdk/cli/env.rb
|
303
316
|
- lib/pdk/cli/errors.rb
|
304
317
|
- lib/pdk/cli/exec.rb
|
305
318
|
- lib/pdk/cli/exec/command.rb
|
@@ -313,6 +326,8 @@ files:
|
|
313
326
|
- lib/pdk/cli/new.rb
|
314
327
|
- lib/pdk/cli/new/class.rb
|
315
328
|
- lib/pdk/cli/new/defined_type.rb
|
329
|
+
- lib/pdk/cli/new/fact.rb
|
330
|
+
- lib/pdk/cli/new/function.rb
|
316
331
|
- lib/pdk/cli/new/module.rb
|
317
332
|
- lib/pdk/cli/new/provider.rb
|
318
333
|
- lib/pdk/cli/new/task.rb
|
@@ -357,11 +372,12 @@ files:
|
|
357
372
|
- lib/pdk/control_repo.rb
|
358
373
|
- lib/pdk/generate.rb
|
359
374
|
- lib/pdk/generate/defined_type.rb
|
375
|
+
- lib/pdk/generate/fact.rb
|
376
|
+
- lib/pdk/generate/function.rb
|
360
377
|
- lib/pdk/generate/module.rb
|
361
378
|
- lib/pdk/generate/provider.rb
|
362
379
|
- lib/pdk/generate/puppet_class.rb
|
363
380
|
- lib/pdk/generate/puppet_object.rb
|
364
|
-
- lib/pdk/generate/resource_api_object.rb
|
365
381
|
- lib/pdk/generate/task.rb
|
366
382
|
- lib/pdk/generate/transport.rb
|
367
383
|
- lib/pdk/i18n.rb
|
@@ -427,12 +443,13 @@ files:
|
|
427
443
|
- lib/pdk/validate/yaml/yaml_syntax_validator.rb
|
428
444
|
- lib/pdk/validate/yaml/yaml_validator_group.rb
|
429
445
|
- lib/pdk/version.rb
|
446
|
+
- lib/pdk/version.rb.orig
|
430
447
|
- locales/config.yaml
|
431
448
|
- locales/pdk.pot
|
432
449
|
homepage: https://github.com/puppetlabs/pdk
|
433
450
|
licenses: []
|
434
451
|
metadata: {}
|
435
|
-
post_install_message:
|
452
|
+
post_install_message:
|
436
453
|
rdoc_options: []
|
437
454
|
require_paths:
|
438
455
|
- lib
|
@@ -440,15 +457,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
440
457
|
requirements:
|
441
458
|
- - ">="
|
442
459
|
- !ruby/object:Gem::Version
|
443
|
-
version: 2.
|
460
|
+
version: 2.4.0
|
444
461
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
445
462
|
requirements:
|
446
463
|
- - ">="
|
447
464
|
- !ruby/object:Gem::Version
|
448
465
|
version: '0'
|
449
466
|
requirements: []
|
450
|
-
|
451
|
-
|
467
|
+
rubyforge_project:
|
468
|
+
rubygems_version: 2.6.14.4
|
469
|
+
signing_key:
|
452
470
|
specification_version: 4
|
453
471
|
summary: A key part of the Puppet Development Kit, the shortest path to better modules
|
454
472
|
test_files: []
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'pdk'
|
2
|
-
|
3
|
-
module PDK
|
4
|
-
module Generate
|
5
|
-
# An abstract class for generated objects that require the Puppet Resource API Gem
|
6
|
-
#
|
7
|
-
# @abstract
|
8
|
-
class ResourceAPIObject < PuppetObject
|
9
|
-
#:nocov: This is tested in spec/acceptance/new_transport_spec.rb
|
10
|
-
# @see PDK::Generate::PuppetObject.check_preconditions
|
11
|
-
def check_preconditions
|
12
|
-
super
|
13
|
-
# Note that these preconditions are only applicable to the current (V1) template rendering layout and will need to be changed
|
14
|
-
# when additional template renderers are introduced.
|
15
|
-
#
|
16
|
-
# These preconditions can be removed once the pdk-templates are carrying the puppet-resource_api gem by default, and have switched
|
17
|
-
# the default mock_with value.
|
18
|
-
sync_path = PDK::Util.find_upwards('.sync.yml')
|
19
|
-
if sync_path.nil?
|
20
|
-
raise_precondition_error(_('.sync.yml not found'))
|
21
|
-
end
|
22
|
-
sync = YAML.load_file(sync_path)
|
23
|
-
if !sync.is_a? Hash
|
24
|
-
raise_precondition_error(_('.sync.yml contents is not a Hash'))
|
25
|
-
elsif !sync.key? 'Gemfile'
|
26
|
-
raise_precondition_error(_('Gemfile configuration not found'))
|
27
|
-
elsif !sync['Gemfile'].key? 'optional'
|
28
|
-
raise_precondition_error(_('Gemfile.optional configuration not found'))
|
29
|
-
elsif !sync['Gemfile']['optional'].key? ':development'
|
30
|
-
raise_precondition_error(_('Gemfile.optional.:development configuration not found'))
|
31
|
-
elsif sync['Gemfile']['optional'][':development'].none? { |g| g['gem'] == 'puppet-resource_api' }
|
32
|
-
raise_precondition_error(_('puppet-resource_api not found in the Gemfile config'))
|
33
|
-
elsif !sync.key? 'spec/spec_helper.rb'
|
34
|
-
raise_precondition_error(_('spec/spec_helper.rb configuration not found'))
|
35
|
-
elsif !sync['spec/spec_helper.rb'].key? 'mock_with'
|
36
|
-
raise_precondition_error(_('spec/spec_helper.rb.mock_with configuration not found'))
|
37
|
-
elsif !sync['spec/spec_helper.rb']['mock_with'] == ':rspec'
|
38
|
-
raise_precondition_error(_('spec/spec_helper.rb.mock_with not set to \':rspec\''))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Helper method to raise an error if the Resource API is not available
|
43
|
-
#
|
44
|
-
# @api private
|
45
|
-
def raise_precondition_error(error)
|
46
|
-
raise PDK::CLI::ExitWithError, _('%{error}: Creating a %{thing_name} needs some local configuration in your module.' \
|
47
|
-
' Please follow the docs at https://puppet.com/docs/puppet/latest/create_types_and_providers_resource_api.html') % {
|
48
|
-
thing_name: friendly_name,
|
49
|
-
error: error,
|
50
|
-
}
|
51
|
-
end
|
52
|
-
#:nocov:
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|