@@ -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.
@@ -120,6 +118,8 @@ the provided regular expression.
120
118
* [ ` 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.
121
119
* [ ` stdlib::ensure ` ] ( #stdlib--ensure ) : function to cast ensure parameter to resource specific value
122
120
* [ ` stdlib::ensure_packages ` ] ( #stdlib--ensure_packages ) : Takes a list of packages and only installs them if they don't already exist.
121
+ * [ ` 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
122
+ * [ ` 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
123
123
* [ ` stdlib::extname ` ] ( #stdlib--extname ) : Returns the Extension (the Portion of Filename in Path starting from the
124
124
last Period).
125
125
* [ ` stdlib::fqdn_rand_string ` ] ( #stdlib--fqdn_rand_string ) : Generates a random alphanumeric string. Combining the ` $fqdn ` fact and an
@@ -1605,125 +1605,39 @@ Data type: `Any`
1605
1605
1606
1606
### <a name =" ensure_resource " ></a >` ensure_resource `
1607
1607
1608
- Type: Ruby 3.x API
1609
-
1610
- user { 'dan':
1611
- ensure => present,
1612
- }
1613
-
1614
- #### Examples
1615
-
1616
- ##### Example usage
1617
-
1618
- ``` puppet
1619
-
1620
- Creates the resource if it does not already exist:
1621
-
1622
- ensure_resource('user', 'dan', {'ensure' => 'present' })
1623
-
1624
- If the resource already exists but does not match the specified parameters,
1625
- this function will attempt to recreate the resource leading to a duplicate
1626
- resource definition error.
1627
-
1628
- An array of resources can also be passed in and each will be created with
1629
- the type and parameters specified if it doesn't already exist.
1630
-
1631
- ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
1632
- ```
1633
-
1634
- #### ` ensure_resource() `
1608
+ Type: Ruby 4.x API
1635
1609
1636
- user { 'dan':
1637
- ensure => present,
1638
- }
1610
+ DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resource ` ] ( #stdlibensure_resource ) instead.
1639
1611
1640
- Returns: ` Any ` created or recreated the passed resource with the passed type and attributes
1612
+ #### ` ensure_resource( Any *$args) `
1641
1613
1642
- ##### Examples
1614
+ The ensure_resource function.
1643
1615
1644
- ###### Example usage
1645
-
1646
- ``` puppet
1647
-
1648
- Creates the resource if it does not already exist:
1616
+ Returns: ` Any `
1649
1617
1650
- ensure_resource('user', 'dan', {'ensure' => 'present' })
1618
+ ##### ` *args `
1651
1619
1652
- If the resource already exists but does not match the specified parameters,
1653
- this function will attempt to recreate the resource leading to a duplicate
1654
- resource definition error.
1620
+ Data type: ` Any `
1655
1621
1656
- An array of resources can also be passed in and each will be created with
1657
- the type and parameters specified if it doesn't already exist.
1658
1622
1659
- ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
1660
- ```
1661
1623
1662
1624
### <a name =" ensure_resources " ></a >` ensure_resources `
1663
1625
1664
- Type: Ruby 3.x API
1665
-
1666
- An hash of resources should be passed in and each will be created with
1667
- the type and parameters specified if it doesn't already exist.
1668
-
1669
- ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
1670
-
1671
- From Hiera Backend:
1672
-
1673
- userlist:
1674
- dan:
1675
- gid: 'mygroup'
1676
- uid: '600'
1677
- alex:
1678
- gid: 'mygroup'
1679
-
1680
- Call:
1681
- ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
1682
-
1683
- #### Examples
1684
-
1685
- ##### Example usage
1686
-
1687
- ``` puppet
1688
-
1689
- user { 'dan':
1690
- gid => 'mygroup',
1691
- ensure => present,
1692
- }
1693
- ```
1694
-
1695
- #### ` ensure_resources() `
1696
-
1697
- An hash of resources should be passed in and each will be created with
1698
- the type and parameters specified if it doesn't already exist.
1699
-
1700
- ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
1626
+ Type: Ruby 4.x API
1701
1627
1702
- From Hiera Backend:
1628
+ DEPRECATED. Use the namespaced function [ ` stdlib::ensure_resources ` ] ( #stdlibensure_resources ) instead.
1703
1629
1704
- userlist:
1705
- dan:
1706
- gid: 'mygroup'
1707
- uid: '600'
1708
- alex:
1709
- gid: 'mygroup'
1630
+ #### ` ensure_resources(Any *$args) `
1710
1631
1711
- Call:
1712
- ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
1632
+ The ensure_resources function.
1713
1633
1714
- Returns: ` Any ` created resources with the passed type and attributes
1634
+ Returns: ` Any `
1715
1635
1716
- ##### Examples
1636
+ ##### ` *args `
1717
1637
1718
- ###### Example usage
1638
+ Data type: ` Any `
1719
1639
1720
- ``` puppet
1721
1640
1722
- user { 'dan':
1723
- gid => 'mygroup',
1724
- ensure => present,
1725
- }
1726
- ```
1727
1641
1728
1642
### <a name =" fact " ></a >` fact `
1729
1643
@@ -3332,7 +3246,7 @@ Data type: `Optional[Enum['directory', 'link', 'mounted', 'service', 'file', 'pa
3332
3246
Type: Ruby 4.x API
3333
3247
3334
3248
It optionally takes a hash as a second parameter that will be passed as the
3335
- third argument to the ensure_resource() function.
3249
+ third argument to the stdlib:: ensure_resource() function.
3336
3250
3337
3251
#### ` stdlib::ensure_packages(Variant[String[1], Array[String[1]]] $packages, Optional[Hash] $default_attributes) `
3338
3252
@@ -3350,7 +3264,7 @@ The packages to ensure are installed.
3350
3264
3351
3265
Data type: ` Optional[Hash] `
3352
3266
3353
- Default attributes to be passed to the ` ensure_resource() ` function
3267
+ Default attributes to be passed to the ` stdlib:: ensure_resource()` function
3354
3268
3355
3269
#### ` stdlib::ensure_packages(Hash[String[1], Any] $packages, Optional[Hash] $default_attributes) `
3356
3270
@@ -3370,6 +3284,172 @@ Data type: `Optional[Hash]`
3370
3284
3371
3285
Default attributes. Package specific attributes from the ` packages ` parameter will take precedence.
3372
3286
3287
+ ### <a name =" stdlib--ensure_resource " ></a >` stdlib::ensure_resource `
3288
+
3289
+ Type: Ruby 4.x API
3290
+
3291
+ @summary
3292
+ Takes a resource type, title, and a list of attributes that describe a
3293
+ resource.
3294
+
3295
+ user { 'dan':
3296
+ ensure => present,
3297
+ }
3298
+
3299
+ @return
3300
+ created or recreated the passed resource with the passed type and attributes
3301
+
3302
+ @example Example usage
3303
+
3304
+ Creates the resource if it does not already exist:
3305
+
3306
+ stdlib::ensure_resource('user', 'dan', {'ensure' => 'present' })
3307
+
3308
+ If the resource already exists but does not match the specified parameters,
3309
+ this function will attempt to recreate the resource leading to a duplicate
3310
+ resource definition error.
3311
+
3312
+ An array of resources can also be passed in and each will be created with
3313
+ the type and parameters specified if it doesn't already exist.
3314
+
3315
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
3316
+
3317
+ #### ` stdlib::ensure_resource(String $type, Variant[String,Array[String]] $title, Hash $params) `
3318
+
3319
+ @summary
3320
+ Takes a resource type, title, and a list of attributes that describe a
3321
+ resource.
3322
+
3323
+ user { 'dan':
3324
+ ensure => present,
3325
+ }
3326
+
3327
+ @return
3328
+ created or recreated the passed resource with the passed type and attributes
3329
+
3330
+ @example Example usage
3331
+
3332
+ Creates the resource if it does not already exist:
3333
+
3334
+ stdlib::ensure_resource('user', 'dan', {'ensure' => 'present' })
3335
+
3336
+ If the resource already exists but does not match the specified parameters,
3337
+ this function will attempt to recreate the resource leading to a duplicate
3338
+ resource definition error.
3339
+
3340
+ An array of resources can also be passed in and each will be created with
3341
+ the type and parameters specified if it doesn't already exist.
3342
+
3343
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
3344
+
3345
+ Returns: ` Any `
3346
+
3347
+ ##### ` type `
3348
+
3349
+ Data type: ` String `
3350
+
3351
+ The resource type to create
3352
+
3353
+ ##### ` title `
3354
+
3355
+ Data type: ` Variant[String,Array[String]] `
3356
+
3357
+ The resource title or array of resource titles
3358
+
3359
+ ##### ` params `
3360
+
3361
+ Data type: ` Hash `
3362
+
3363
+ The resource parameters
3364
+
3365
+ ### <a name =" stdlib--ensure_resources " ></a >` stdlib::ensure_resources `
3366
+
3367
+ Type: Ruby 4.x API
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
+ #### ` stdlib::ensure_resources(String $type, Hash[String,Hash] $titles, Optional[Hash] $params) `
3401
+
3402
+ @summary
3403
+ Takes a resource type, title (only hash), and a list of attributes that describe a
3404
+ resource.
3405
+
3406
+ @return
3407
+ created resources with the passed type and attributes
3408
+
3409
+ @example Example usage
3410
+
3411
+ user { 'dan':
3412
+ gid => 'mygroup',
3413
+ ensure => present,
3414
+ }
3415
+
3416
+ An hash of resources should be passed in and each will be created with
3417
+ the type and parameters specified if it doesn't already exist.
3418
+
3419
+ stdlib::ensure_resources('user', {'dan' => { gid => 'mygroup', uid => '600' }, 'alex' => { gid => 'mygroup' }}, {'ensure' => 'present'})
3420
+
3421
+ From Hiera Backend:
3422
+
3423
+ userlist:
3424
+ dan:
3425
+ gid: 'mygroup'
3426
+ uid: '600'
3427
+ alex:
3428
+ gid: 'mygroup'
3429
+
3430
+ Call:
3431
+ ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'})
3432
+
3433
+ Returns: ` Any `
3434
+
3435
+ ##### ` type `
3436
+
3437
+ Data type: ` String `
3438
+
3439
+ The resource type to create
3440
+
3441
+ ##### ` titles `
3442
+
3443
+ Data type: ` Hash[String,Hash] `
3444
+
3445
+ A hash of resource titles mapping to resource parameters
3446
+
3447
+ ##### ` params `
3448
+
3449
+ Data type: ` Optional[Hash] `
3450
+
3451
+ A hash of default parameters to be merged with individual resource parameters
3452
+
3373
3453
### <a name =" stdlib--extname " ></a >` stdlib::extname `
3374
3454
3375
3455
Type: Ruby 4.x API
0 commit comments