def remove_resource(zone, resource_type, resource_key, resource_value):
 ret = {'status': True}
 cfg_file = salt.utils.files.mkstemp()
 with salt.utils.fpopen(cfg_file, 'w+', mode=384) as fp_:
  fp_.write('remove {0} {1}={2}\n'.format(resource_type, resource_key, resource_value))
 if cfg_file:
  res = __salt__['cmd.run_all']('zonecfg -z {zone} -f {path}'.format(zone=zone, path=cfg_file))
  ret['status'] = (res['retcode'] == 0)
  ret['message'] = (res['stdout'] if ret['status'] else res['stderr'])
  ret['message'] = ret['message'].replace('zonecfg: ', '')
  if (ret['message'] == ''):
   del ret['message']
  __salt__['file.remove'](cfg_file)
 return ret

def remove_resource ( zone , resource_type , resource_key , resource_value ) : ret = { 'status' : True } cfg_file = salt . utils . files . mkstemp ( ) with salt . utils . fpopen ( cfg_file , 'w+' , mode = 384 ) as fp_ : fp_ . write ( 'remove {0} {1}={2}\n' . format ( resource_type , resource_key , resource_value ) ) if cfg_file : res = __salt__ [ 'cmd.run_all' ] ( 'zonecfg -z {zone} -f {path}' . format ( zone = zone , path = cfg_file ) ) ret [ 'status' ] = ( res [ 'retcode' ] == 0 ) ret [ 'message' ] = ( res [ 'stdout' ] if ret [ 'status' ] else res [ 'stderr' ] ) ret [ 'message' ] = ret [ 'message' ] . replace ( 'zonecfg: ' , '' ) if ( ret [ 'message' ] == '' ) : del ret [ 'message' ] __salt__ [ 'file.remove' ] ( cfg_file ) return ret
remove a resource zone : string name of zone resource_type : string type of resource resource_key : string key for resource selection resource_value : string value for resource selection cli example: .