40
40
- The count value must be an integer; a value of zero is not permitted.
41
41
type: int
42
42
required: false
43
+ fail_on_nodata:
44
+ description:
45
+ - Specifies whether the module should fail if no data is returned by the
46
+ query. If set to true, the module will fail if no data is returned.
47
+ - Default behaviour is for the module to fail if no data is returned. When
48
+ set to false, the module will return OK, just with no records.
49
+ type: bool
50
+ required: false
51
+ default: true
43
52
'''
44
53
45
54
87
96
value: MYGRP
88
97
record_count: 1
89
98
99
+ - name: pass module even if bundle definition is not found
100
+ cmci_get:
101
+ cmci_host: 'winmvs2c.hursley.ibm.com'
102
+ cmci_port: 10080
103
+ cmci_cert: './sec/ansible.pem'
104
+ cmci_key: './sec/ansible.key'
105
+ context: 'iyk3z0r9'
106
+ type: cicsdefinitionbundle
107
+ resources:
108
+ filter:
109
+ name: MYBUNDLE
110
+ get_parameters:
111
+ - name: csdgroup
112
+ value: MYGRP
113
+ record_count: 1
114
+ fail_on_nodata: "false"
115
+
90
116
- name: Using complex_filter to combine filter expressions and change operators
91
117
cmci_get:
92
118
cmci_host: 'winmvs2c.hursley.ibm.com'
496
522
497
523
498
524
_RECORD_COUNT = 'record_count'
525
+ _FAIL_ON_NODATA = 'fail_on_nodata'
499
526
500
527
501
528
class AnsibleCMCIGetModule (AnsibleCMCIModule ):
@@ -507,6 +534,10 @@ def init_argument_spec(self): # type: () -> Dict
507
534
argument_spec .update ({
508
535
_RECORD_COUNT : {
509
536
'type' : 'int'
537
+ },
538
+ _FAIL_ON_NODATA : {
539
+ 'type' : 'bool' ,
540
+ 'default' : True
510
541
}
511
542
})
512
543
argument_spec .update (RESOURCES_ARGUMENT )
@@ -522,6 +553,14 @@ def init_url(self): # type: () -> str
522
553
url = url + '//' + str (self ._p .get (_RECORD_COUNT ))
523
554
524
555
return url
556
+
557
+ def get_ok_cpsm_response_codes (self ):
558
+ ok_codes = super (AnsibleCMCIGetModule , self ).get_ok_cpsm_response_codes ()
559
+
560
+ if not self ._p .get (_FAIL_ON_NODATA ):
561
+ ok_codes .append (1027 )
562
+
563
+ return ok_codes
525
564
526
565
527
566
def main ():
0 commit comments