@@ -47,10 +47,8 @@ from an array or key from a hash.
47
47
* [ ` dos2unix ` ] ( #dos2unix ) : Returns the Unix version of the given string.
48
48
* [ ` enclose_ipv6 ` ] ( #enclose_ipv6 ) : Takes an array of ip addresses and encloses the ipv6 addresses with square brackets.
49
49
* [ ` ensure_packages ` ] ( #ensure_packages ) : DEPRECATED. Use the namespaced function [ ` stdlib::ensure_packages ` ] ( #stdlibensure_packages ) instead.
50
- * [ ` ensure_resource ` ] ( #ensure_resource ) : Takes a resource type, title, and a list of attributes that describe a
51
- resource.
52
- * [ ` ensure_resources ` ] ( #ensure_resources ) : Takes a resource type, title (only hash), and a list of attributes that describe a
53
- resource.
50
+ * [ ` ensure_resource ` ] ( #ensure_resource ) : DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resource ` ] ( #stdlibensure_resource ) instead.
51
+ * [ ` ensure_resources ` ] ( #ensure_resources ) : DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resources ` ] ( #stdlibensure_resources ) instead.
54
52
* [ ` fact ` ] ( #fact ) : Digs into the facts hash using dot-notation
55
53
* [ ` fqdn_rand_string ` ] ( #fqdn_rand_string ) : DEPRECATED. Use the namespaced function [ ` stdlib::fqdn_rand_string ` ] ( #stdlibfqdn_rand_string ) instead.
56
54
* [ ` fqdn_rotate ` ] ( #fqdn_rotate ) : DEPRECATED. Use the namespaced function [ ` stdlib::fqdn_rotate ` ] ( #stdlibfqdn_rotate ) instead.
@@ -119,6 +117,8 @@ the provided regular expression.
119
117
* [ ` stdlib::end_with ` ] ( #stdlib--end_with ) : Returns true if str ends with one of the prefixes given. Each of the prefixes should be a String.
120
118
* [ ` stdlib::ensure ` ] ( #stdlib--ensure ) : function to cast ensure parameter to resource specific value
121
119
* [ ` stdlib::ensure_packages ` ] ( #stdlib--ensure_packages ) : Takes a list of packages and only installs them if they don't already exist.
120
+ * [ ` stdlib::ensure_resource ` ] ( #stdlib--ensure_resource ) : @summary Takes a resource type, title, and a list of attributes that describe a resource. user { 'dan': ensure => present, } @r
121
+ * [ ` stdlib::ensure_resources ` ] ( #stdlib--ensure_resources ) : @summary Takes a resource type, title (only hash), and a list of attributes that describe a resource. @return created resources wi
122
122
* [ ` stdlib::extname ` ] ( #stdlib--extname ) : Returns the Extension (the Portion of Filename in Path starting from the
123
123
last Period).
124
124
* [ ` stdlib::fqdn_rand_string ` ] ( #stdlib--fqdn_rand_string ) : Generates a random alphanumeric string. Combining the ` $fqdn ` fact and an
@@ -1606,125 +1606,39 @@ Data type: `Any`
1606
1606
1607
1607
### <a name =" ensure_resource " ></a >` ensure_resource `
1608
1608
1609
- Type: Ruby 3.x API
1610
-
1611
- user { 'dan':
1612
- ensure => present,
1613
- }
1614
-
1615
- #### Examples
1616
-
1617
- ##### Example usage
1618
-
1619
- ``` puppet
1620
-
1621
- Creates the resource if it does not already exist:
1622
-
1623
- ensure_resource('user', 'dan', {'ensure' => 'present' })
1624
-
1625
- If the resource already exists but does not match the specified parameters,
1626
- this function will attempt to recreate the resource leading to a duplicate
1627
- resource definition error.
1628
-
1629
- An array of resources can also be passed in and each will be created with
1630
- the type and parameters specified if it doesn't already exist.
1631
-
1632
- ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
1633
- ```
1634
-
1635
- #### ` ensure_resource() `
1609
+ Type: Ruby 4.x API
1636
1610
1637
- user { 'dan':
1638
- ensure => present,
1639
- }
1611
+ DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resource ` ] ( #stdlibensure_resource ) instead.
1640
1612
1641
- Returns: ` Any ` created or recreated the passed resource with the passed type and attributes
1613
+ #### ` ensure_resource( Any *$args) `
1642
1614
1643
- ##### Examples
1615
+ The ensure_resource function.
1644
1616
1645
- ###### Example usage
1646
-
1647
- ``` puppet
1648
-
1649
- Creates the resource if it does not already exist:
1617
+ Returns: ` Any `
1650
1618
1651
- ensure_resource('user', 'dan', {'ensure' => 'present' })
1619
+ ##### ` *args `
1652
1620
1653
- If the resource already exists but does not match the specified parameters,
1654
- this function will attempt to recreate the resource leading to a duplicate
1655
- resource definition error.
1621
+ Data type: ` Any `
1656
1622
1657
- An array of resources can also be passed in and each will be created with
1658
- the type and parameters specified if it doesn't already exist.
1659
1623
1660
- ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
1661
- ```
1662
1624
1663
1625
### <a name =" ensure_resources " ></a >` ensure_resources `
1664
1626
1665
- Type: Ruby 3.x API
1666
-
1667
- An hash of resources should be passed in and each will be created with
1668
- the type and parameters specified if it doesn't already exist.
1669
-
1670
- ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
1671
-
1672
- From Hiera Backend:
1673
-
1674
- userlist:
1675
- dan:
1676
- gid: 'mygroup'
1677
- uid: '600'
1678
- alex:
1679
- gid: 'mygroup'
1680
-
1681
- Call:
1682
- ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
1683
-
1684
- #### Examples
1685
-
1686
- ##### Example usage
1687
-
1688
- ``` puppet
1689
-
1690
- user { 'dan':
1691
- gid => 'mygroup',
1692
- ensure => present,
1693
- }
1694
- ```
1695
-
1696
- #### ` ensure_resources() `
1697
-
1698
- An hash of resources should be passed in and each will be created with
1699
- the type and parameters specified if it doesn't already exist.
1700
-
1701
- ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
1627
+ Type: Ruby 4.x API
1702
1628
1703
- From Hiera Backend:
1629
+ DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resources ` ] ( #stdlibensure_resources ) instead.
1704
1630
1705
- userlist:
1706
- dan:
1707
- gid: 'mygroup'
1708
- uid: '600'
1709
- alex:
1710
- gid: 'mygroup'
1631
+ #### ` ensure_resources(Any *$args) `
1711
1632
1712
- Call:
1713
- ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
1633
+ The ensure_resources function.
1714
1634
1715
- Returns: ` Any ` created resources with the passed type and attributes
1635
+ Returns: ` Any `
1716
1636
1717
- ##### Examples
1637
+ ##### ` *args `
1718
1638
1719
- ###### Example usage
1639
+ Data type: ` Any `
1720
1640
1721
- ``` puppet
1722
1641
1723
- user { 'dan':
1724
- gid => 'mygroup',
1725
- ensure => present,
1726
- }
1727
- ```
1728
1642
1729
1643
### <a name =" fact " ></a >` fact `
1730
1644
@@ -3299,7 +3213,7 @@ Data type: `Optional[Enum['directory', 'link', 'mounted', 'service', 'file', 'pa
3299
3213
Type: Ruby 4.x API
3300
3214
3301
3215
It optionally takes a hash as a second parameter that will be passed as the
3302
- third argument to the ensure_resource() function.
3216
+ third argument to the stdlib:: ensure_resource() function.
3303
3217
3304
3218
#### ` stdlib::ensure_packages(Variant[String[1], Array[String[1]]] $packages, Optional[Hash] $default_attributes) `
3305
3219
@@ -3317,7 +3231,7 @@ The packages to ensure are installed.
3317
3231
3318
3232
Data type: ` Optional[Hash] `
3319
3233
3320
- Default attributes to be passed to the ` ensure_resource() ` function
3234
+ Default attributes to be passed to the ` stdlib:: ensure_resource()` function
3321
3235
3322
3236
#### ` stdlib::ensure_packages(Hash[String[1], Any] $packages, Optional[Hash] $default_attributes) `
3323
3237
@@ -3337,6 +3251,172 @@ Data type: `Optional[Hash]`
3337
3251
3338
3252
Default attributes. Package specific attributes from the ` packages ` parameter will take precedence.
3339
3253
3254
+ ### <a name =" stdlib--ensure_resource " ></a >` stdlib::ensure_resource `
3255
+
3256
+ Type: Ruby 4.x API
3257
+
3258
+ @summary
3259
+ Takes a resource type, title, and a list of attributes that describe a
3260
+ resource.
3261
+
3262
+ user { 'dan':
3263
+ ensure => present,
3264
+ }
3265
+
3266
+ @return
3267
+ created or recreated the passed resource with the passed type and attributes
3268
+
3269
+ @example Example usage
3270
+
3271
+ Creates the resource if it does not already exist:
3272
+
3273
+ stdlib::ensure_resource('user', 'dan', {'ensure' => 'present' })
3274
+
3275
+ If the resource already exists but does not match the specified parameters,
3276
+ this function will attempt to recreate the resource leading to a duplicate
3277
+ resource definition error.
3278
+
3279
+ An array of resources can also be passed in and each will be created with
3280
+ the type and parameters specified if it doesn't already exist.
3281
+
3282
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
3283
+
3284
+ #### ` stdlib::ensure_resource(String $type, Variant[String,Array[String]] $title, Hash $params) `
3285
+
3286
+ @summary
3287
+ Takes a resource type, title, and a list of attributes that describe a
3288
+ resource.
3289
+
3290
+ user { 'dan':
3291
+ ensure => present,
3292
+ }
3293
+
3294
+ @return
3295
+ created or recreated the passed resource with the passed type and attributes
3296
+
3297
+ @example Example usage
3298
+
3299
+ Creates the resource if it does not already exist:
3300
+
3301
+ stdlib::ensure_resource('user', 'dan', {'ensure' => 'present' })
3302
+
3303
+ If the resource already exists but does not match the specified parameters,
3304
+ this function will attempt to recreate the resource leading to a duplicate
3305
+ resource definition error.
3306
+
3307
+ An array of resources can also be passed in and each will be created with
3308
+ the type and parameters specified if it doesn't already exist.
3309
+
3310
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
3311
+
3312
+ Returns: ` Any `
3313
+
3314
+ ##### ` type `
3315
+
3316
+ Data type: ` String `
3317
+
3318
+ The resource type to create
3319
+
3320
+ ##### ` title `
3321
+
3322
+ Data type: ` Variant[String,Array[String]] `
3323
+
3324
+ The resource title or array of resource titles
3325
+
3326
+ ##### ` params `
3327
+
3328
+ Data type: ` Hash `
3329
+
3330
+ The resource parameters
3331
+
3332
+ ### <a name =" stdlib--ensure_resources " ></a >` stdlib::ensure_resources `
3333
+
3334
+ Type: Ruby 4.x API
3335
+
3336
+ @summary
3337
+ Takes a resource type, title (only hash), and a list of attributes that describe a
3338
+ resource.
3339
+
3340
+ @return
3341
+ created resources with the passed type and attributes
3342
+
3343
+ @example Example usage
3344
+
3345
+ user { 'dan':
3346
+ gid => 'mygroup',
3347
+ ensure => present,
3348
+ }
3349
+
3350
+ An hash of resources should be passed in and each will be created with
3351
+ the type and parameters specified if it doesn't already exist.
3352
+
3353
+ stdlib::ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
3354
+
3355
+ From Hiera Backend:
3356
+
3357
+ userlist:
3358
+ dan:
3359
+ gid: 'mygroup'
3360
+ uid: '600'
3361
+ alex:
3362
+ gid: 'mygroup'
3363
+
3364
+ Call:
3365
+ ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
3366
+
3367
+ #### ` stdlib::ensure_resources(String $type, Hash[String,Hash] $titles, Optional[Hash] $params) `
3368
+
3369
+ @summary
3370
+ Takes a resource type, title (only hash), and a list of attributes that describe a
3371
+ resource.
3372
+
3373
+ @return
3374
+ created resources with the passed type and attributes
3375
+
3376
+ @example Example usage
3377
+
3378
+ user { 'dan':
3379
+ gid => 'mygroup',
3380
+ ensure => present,
3381
+ }
3382
+
3383
+ An hash of resources should be passed in and each will be created with
3384
+ the type and parameters specified if it doesn't already exist.
3385
+
3386
+ stdlib::ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
3387
+
3388
+ From Hiera Backend:
3389
+
3390
+ userlist:
3391
+ dan:
3392
+ gid: 'mygroup'
3393
+ uid: '600'
3394
+ alex:
3395
+ gid: 'mygroup'
3396
+
3397
+ Call:
3398
+ ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
3399
+
3400
+ Returns: ` Any `
3401
+
3402
+ ##### ` type `
3403
+
3404
+ Data type: ` String `
3405
+
3406
+ The resource type to create
3407
+
3408
+ ##### ` titles `
3409
+
3410
+ Data type: ` Hash[String,Hash] `
3411
+
3412
+ A hash of resource titles mapping to resource parameters
3413
+
3414
+ ##### ` params `
3415
+
3416
+ Data type: ` Optional[Hash] `
3417
+
3418
+ A hash of default parameters to be merged with individual resource parameters
3419
+
3340
3420
### <a name =" stdlib--extname " ></a >` stdlib::extname `
3341
3421
3342
3422
Type: Ruby 4.x API
0 commit comments