Ejemplo n.º 1
0
            region_endpoints = endpoints

    if not region_endpoints:
        ca.log_fail("Failing, region not found in endpoint list.")
        exit()

    if ca.conf.get('date'):
        p = pdt.Calendar()
        result = p.parse(ca.conf['date'])
        dt = datetime.datetime.fromtimestamp(mktime(result[0]))
        path = dt.strftime(ca.conf['name'])
    else:
        path = ca.conf['name']

    try:
        headers = swiftclient.head_object(region_endpoints['publicURL'],
                                          ca.creds['token'],
                                          ca.conf['container'], path)
        if headers['content-length'] >= 0:
            ca.log("File exists!")

    except swiftclient.client.ClientException, e:
        ca.log("File doesn't exist!")
        ca.email(
            "File missing: " + ca.conf['container'] + "/" + path, '''
	The container '%s' appears to be missing the file '%s'.
	''' % (ca.conf['container'], path))


ca.run(agent)
Ejemplo n.º 2
0
	for endpoints in object_store_catalog:
		if endpoints['region'] == ca.conf['region']:
			region_endpoints = endpoints
	
	if not region_endpoints:
		ca.log_fail("Failing, region not found in endpoint list.")
		exit()
	
	if ca.conf.get('date'):
		p = pdt.Calendar()
		result = p.parse(ca.conf['date'])
		dt = datetime.datetime.fromtimestamp(mktime(result[0]))
		path = dt.strftime(ca.conf['name'])
	else:
		path = ca.conf['name']
	
	try:
		headers = swiftclient.head_object(region_endpoints['publicURL'],ca.creds['token'],
												ca.conf['container'],path)
		if headers['content-length'] >= 0:
			ca.log("File exists!")
			
	except swiftclient.client.ClientException, e:
		ca.log("File doesn't exist!")
		ca.email("File missing: "+ca.conf['container']+"/"+path,'''
	The container '%s' appears to be missing the file '%s'.
	''' % (ca.conf['container'], path))
		

ca.run(agent)