class AWSResourceManager_test(unittest.TestCase):
    def setUp(self):
        self.mgr = AWSResourceManager('us-west-2')  #oregon

    def tearDown(self):
        pass

    def test_get_instance_list(self):
        vm_list = self.mgr.get_instance_list()
        print "%d instances" % len(vm_list)
        for inst in vm_list:
            print "\tvm inst: " + inst

    def test_get_instance_list_key_name(self):
        vm_list = self.mgr.get_instance_list(key_name='bogus')
        assert len(vm_list) == 0
class AWSResourceManager_test(unittest.TestCase):
	
    def setUp(self):
	self.mgr = AWSResourceManager('us-west-2') #oregon

    def tearDown(self):
        pass

    def test_get_instance_list(self):
	vm_list = self.mgr.get_instance_list()
	print "%d instances" % len(vm_list)
	for inst in vm_list :
		print "\tvm inst: " + inst	

    def test_get_instance_list_key_name(self):
	vm_list = self.mgr.get_instance_list(key_name='bogus')
	assert len(vm_list) == 0
class AWSResourceManager_test(unittest.TestCase):
	
    def setUp(self):
	set_debug(True)
	self.mgr = AWSResourceManager('us-east-1') # east coast

    def tearDown(self):
        pass

    def test_get_instance_list(self):
	vm_list = self.mgr.get_instance_list()
	print "%d instances" % len(vm_list)
	for inst in vm_list :
		if inst:
			msg("\tinst: " + inst)
		else:
			msg("\tinst: <null>")

    def test_stop_instance(self):
	self.mgr.stop_instance(aws_id)
	pass

    def test_start_instance(self):
	self.mgr.start_instance(aws_id)
	pass

    def test_get_instance_list_key_name(self):
	vm_list = self.mgr.get_instance_list(key_name='bogus')
	assert len(vm_list) == 0
    def setUp(self):
	set_debug(True)
	self.mgr = AWSResourceManager('us-east-1') # east coast
 def setUp(self):
     self.mgr = AWSResourceManager('us-west-2')  #oregon
    def setUp(self):
	self.mgr = AWSResourceManager('us-west-2') #oregon
Exemple #7
0
# To enable debug => set debug=True in BaseUtil

import os
import sys
import BaseUtil

from BaseUtil import msg
from BaseUtil import error
from BaseUtil import os_cmd
from AWS import AWSResourceManager
from AWS import add_sudoer

BaseUtil.set_debug(True)

mgr = AWSResourceManager('us-east-1') 

instance = mgr.start_instance('i-ba73ff54')

ip_address = instance.ip_address

while True:

    (s,o) = os_cmd("checkport.py " + ip_address + " 12345")
    if s == 0 :
        break
    BaseUtil.sleep(20)

if s > 0 :
	msg("The amazon VM is not reachable - please make sure AWS instances are running and "
            + "'amazonhost' is configured properly.")