35
35
or a UNIX System Services file path, to query.
36
36
- Data sets can be sequential, partitioned (PDS), partitioned
37
37
extended (PDSE), VSAMs or generation data sets (GDS).
38
+ - This option doesn't accept the use of wilcards (? and *).
38
39
type: str
39
40
required: true
40
41
aliases:
77
78
type: bool
78
79
required: false
79
80
default: false
81
+ recall:
82
+ description:
83
+ - Whether to recall a migrated data set to fully query its
84
+ attributes.
85
+ - If set to C(false), the module will return a limited amount of
86
+ information for a migrated data set.
87
+ - Recalling a data set will make the module take longer to execute.
88
+ - Ignored when the data set is not found to be migrated.
89
+ - The data set will not be migrated again afterwards.
90
+ - The data set will not get recalled when running the module in
91
+ check mode.
92
+ type: bool
93
+ required: false
94
+ default: false
80
95
tmp_hlq:
81
96
description:
82
97
- Override the default high level qualifier (HLQ) for temporary data
@@ -1708,7 +1723,8 @@ def __init__(
1708
1723
ds_type ,
1709
1724
tmp_hlq = None ,
1710
1725
missing_volumes = None ,
1711
- alias = None
1726
+ alias = None ,
1727
+ migrated = False
1712
1728
):
1713
1729
"""Create a new handler that will handle the query of a sequential or
1714
1730
partitioned data set. This subclass should only be instantiated by
@@ -1725,6 +1741,7 @@ def __init__(
1725
1741
missing_volumes (list, optional) -- List of volumes where a data set was searched
1726
1742
but not found.
1727
1743
alias (str, optional) -- Alias of the data set that the user provided.
1744
+ migrated (bool, optional) -- Whether it is a migrated data set.
1728
1745
"""
1729
1746
super ().__init__ (
1730
1747
name ,
@@ -1737,6 +1754,7 @@ def __init__(
1737
1754
alias = alias
1738
1755
)
1739
1756
self .missing_volumes = missing_volumes
1757
+ self .migrated = migrated
1740
1758
1741
1759
def query (self ):
1742
1760
"""Uses LISTDSI to query facts about a data set, while also handling
@@ -1754,6 +1772,14 @@ def query(self):
1754
1772
data = super ().query ()
1755
1773
attributes = {}
1756
1774
1775
+ if self .migrated :
1776
+ data ['attributes' ] = fill_missing_attrs (
1777
+ self ._parse_attributes (attributes ),
1778
+ self .expected_attrs
1779
+ )
1780
+
1781
+ return data
1782
+
1757
1783
try :
1758
1784
# First creating a temp data set to hold the LISTDSI script.
1759
1785
# All options are meant to allocate just enough space for it.
@@ -2293,7 +2319,8 @@ def get_data_set_handler(
2293
2319
volumes ,
2294
2320
module ,
2295
2321
tmp_hlq = None ,
2296
- sms_managed = False
2322
+ sms_managed = False ,
2323
+ recall = False
2297
2324
):
2298
2325
"""Returns the correct handler needed depending on the type of data set
2299
2326
we will query.
@@ -2305,6 +2332,7 @@ def get_data_set_handler(
2305
2332
module (AnsibleModule) -- Ansible object with the task's context.
2306
2333
tmp_hlq (str, optional) -- Temp HLQ for certain data set operations.
2307
2334
sms_managed (bool, optional) -- Whether the data set is managed by SMS.
2335
+ recall (bool, optional) -- Whether a migrated data set should be recalled.
2308
2336
2309
2337
Returns
2310
2338
-------
@@ -2321,6 +2349,27 @@ def get_data_set_handler(
2321
2349
2322
2350
alias_name = None
2323
2351
2352
+ has_been_migrated = DataSet .check_if_data_set_migrated (name )
2353
+ if has_been_migrated :
2354
+ if recall and not module .check_mode :
2355
+ rc , stdout , stderr = DataSet .recall_migrated_data_set (
2356
+ name ,
2357
+ module ,
2358
+ tmp_hlq = tmp_hlq
2359
+ )
2360
+
2361
+ # Ignoring whatever comes out of stderr because tsocmd decides
2362
+ # to pollute it even when the command runs fine.
2363
+ if rc != 0 :
2364
+ raise QueryException (
2365
+ 'An error ocurred while recalling a migrated data set.' ,
2366
+ rc ,
2367
+ stdout ,
2368
+ stderr
2369
+ )
2370
+ else :
2371
+ return NonVSAMDataSetHandler (name , 'MIGRAT' , module , sms_managed , None , migrated = True )
2372
+
2324
2373
try :
2325
2374
is_an_alias , base_name = DataSet .get_name_if_data_set_is_alias (
2326
2375
name ,
@@ -2385,6 +2434,7 @@ def get_facts_handler(
2385
2434
volumes = None ,
2386
2435
tmp_hlq = None ,
2387
2436
sms_managed = False ,
2437
+ recall = False ,
2388
2438
file_args = None
2389
2439
):
2390
2440
"""Returns the correct handler needed depending on the type of resource
@@ -2398,14 +2448,15 @@ def get_facts_handler(
2398
2448
volumes (list, optional) -- Volumes where a data set is allocated.
2399
2449
tmp_hlq (str, optional) -- Temp HLQ for certain data set operations.
2400
2450
sms_managed (bool, optional) -- Whether a data set is managed by SMS.
2451
+ recall (bool, optional) -- Whether migrated data sets should be recalled.
2401
2452
file_args (dict, optional) -- Options affecting how a file is query.
2402
2453
2403
2454
Returns
2404
2455
-------
2405
2456
FactsHandler -- Handler for data sets/GDGs/aggregates/files.
2406
2457
"""
2407
2458
if resource_type == 'data_set' :
2408
- return get_data_set_handler (name , volumes , module , tmp_hlq , sms_managed )
2459
+ return get_data_set_handler (name , volumes , module , tmp_hlq , sms_managed , recall )
2409
2460
elif resource_type == 'gdg' :
2410
2461
return GenerationDataGroupHandler (name , module , tmp_hlq )
2411
2462
elif resource_type == 'file' :
@@ -2441,6 +2492,11 @@ def run_module():
2441
2492
'required' : False ,
2442
2493
'default' : False
2443
2494
},
2495
+ 'recall' : {
2496
+ 'type' : 'bool' ,
2497
+ 'required' : False ,
2498
+ 'default' : False
2499
+ },
2444
2500
'tmp_hlq' : {
2445
2501
'type' : 'str' ,
2446
2502
'required' : False
@@ -2490,6 +2546,10 @@ def run_module():
2490
2546
'arg_type' : 'bool' ,
2491
2547
'required' : False
2492
2548
},
2549
+ 'recall' : {
2550
+ 'arg_type' : 'bool' ,
2551
+ 'required' : False
2552
+ },
2493
2553
'tmp_hlq' : {
2494
2554
'arg_type' : 'str' ,
2495
2555
'required' : False
@@ -2527,6 +2587,7 @@ def run_module():
2527
2587
resource_type = module .params .get ('type' )
2528
2588
tmp_hlq = module .params .get ('tmp_hlq' )
2529
2589
sms_managed = module .params .get ('sms_managed' )
2590
+ recall = module .params .get ('recall' )
2530
2591
file_args = {
2531
2592
'follow' : module .params .get ('follow' ),
2532
2593
'get_mime' : module .params .get ('get_mime' ),
@@ -2542,6 +2603,7 @@ def run_module():
2542
2603
volumes ,
2543
2604
tmp_hlq ,
2544
2605
sms_managed ,
2606
+ recall ,
2545
2607
file_args
2546
2608
)
2547
2609
except QueryException as err :
0 commit comments