@@ -13,6 +13,7 @@ def ensure(module):
1313 name = module .params ['name' ]
1414 path = module .params ['path' ]
1515 state = module .params ['state' ]
16+ os_family = module .params ['os_family' ]
1617
1718 foreman_host = module .params ['foreman_host' ]
1819 foreman_port = module .params ['foreman_port' ]
@@ -32,6 +33,7 @@ def ensure(module):
3233 module .fail_json (msg = 'Could not get medium: {0}' .format (e .message ))
3334
3435 data ['path' ] = path
36+ data ['os_family' ] = os_family
3537
3638 if not medium and state == 'present' :
3739 try :
@@ -47,12 +49,12 @@ def ensure(module):
4749 return True , medium
4850 except ForemanError as e :
4951 module .fail_json ('Could not delete medium: {0}' .format (e .message ))
50- if medium .get ('path' ) != path :
52+ if medium .get ('path' ) != path or medium . get ( 'os_family' ) != os_family :
5153 try :
5254 medium = theforeman .update_medium (id = medium .get ('id' ), data = data )
5355 return True , medium
5456 except ForemanError as e :
55- module .fail_json ('Could not update medium: {0}' .format (e .message ))
57+ module .fail_json (msg = 'Could not update medium: {0}' .format (e .message ))
5658
5759 return False , medium
5860
@@ -62,6 +64,7 @@ def main():
6264 argument_spec = dict (
6365 name = dict (type = 'str' , required = True ),
6466 path = dict (type = 'str' , required = False ),
67+ os_family = dict (type = 'str' , required = False ),
6568 state = dict (type = 'str' , default = 'present' , choices = ['present' , 'absent' ]),
6669 foreman_host = dict (type = 'str' , default = '127.0.0.1' ),
6770 foreman_port = dict (type = 'str' , default = '443' ),
0 commit comments