def delete_config(config_file, ignore_deleted=False): """ Delete the objects in the given json config file. :param ignore_deleted: if true, do not raise an error if already deleted; e.g. objects may have already been deleted when running delete twice """ if suite_vars.skip_delete_config: logger.info( "Skipping delete config as skip_delete_config is set to True") return logger.info('Deleting from config %s' % config_file) json_data, _ = get_parsed_json(config_file) process_cloud_specific_data(json_data, operation='delete') obj_type_name_list = get_delete_objs(json_data) config = get_config() cloud = config.get_mode(key='cloud') for obj_type_name in obj_type_name_list: obj_type = obj_type_name[0].lower() obj_name = obj_type_name[1] switch_mode(cloud=None) if obj_type in ['vsvip']: check_status_code = False else: check_status_code = not ignore_deleted cloud_name = get_cloud_name_from_obj( obj_type, name=obj_name, check_status_code=check_status_code) logger.info('Deleting %s name=%s in cloud %s' % (obj_type, obj_name, cloud_name)) switch_mode(cloud=cloud_name) delete(obj_type, name=obj_name, check_status_code=check_status_code) switch_mode(cloud=cloud)
def deleteResponse(self, reqURL, data): ''' method calling REST DELETE request :param reqURL: REST resource url :type reqURL: string :param data: data body for the request :type data: JSON format :return: dictionary containing returnCode and buffer :rtype: dictionary ''' if self.verbose: print 'Req URL: ', reqURL res = rest.delete(self.switch_ip, reqURL, data, self.verbose) if isinstance(res, urllib2.URLError): return (555, res.reason) else: try: return (res["response"].status, res["data"]) except: return (res["response"].status, res["response"].reason)
def delete(url, pk, *args, **kwargs): return rest.delete(url, klass, pk)
def delete_all_sensors(api): sensors = get(api + "/sensors") for k, v in ((k, v) for k, v in sensors.iteritems() if v["manufacturername"] == "ErikGroeneveld"): print "Deleting sensor", k delete(api + "/sensors/%s" % k)
def delete_campaign(url, pk): rest.delete(url, 'openproximity/marketingcampaign', pk)
import rest ## test creating and deleting a service print rest.delete('localhost','/myservice', 8080) print rest.get('localhost','/myservice', 8080) print rest.put('localhost', '/myservice', 8080) print rest.get('localhost','/myservice', 8080) print rest.delete('localhost','/myservice', 8080)
import rest ## test creating and deleting a service print rest.delete('localhost', '/myservice', 8080) print rest.get('localhost', '/myservice', 8080) print rest.put('localhost', '/myservice', 8080) print rest.get('localhost', '/myservice', 8080) print rest.delete('localhost', '/myservice', 8080)
def delete_groups(self, name=''): for group in self.groups(): if name.lower() in group.name.lower(): print "Deleting group", group.name delete(group.url())
def delete_rule(API, rule_id): delete("%(API)s/rules/%(rule_id)s" % locals())