Revision bec0786b

b/ci/snf-ci
11 11
from optparse import OptionParser
12 12

  
13 13
CREATE_SERVER_CMD = "create"
14
DELETE_SERVER_CMD = "delete"
14 15
BUILD_SYNNEFO_CMD = "build"
15 16
BUILD_DOCS_SYNNEFO_CMD = "docs"
16 17
DEPLOY_SYNNEFO_CMD = "deploy"
......
30 31

  
31 32
AVAILABLE_COMMANDS = [
32 33
    CREATE_X2GO_FILE,
34
    DELETE_SERVER_CMD,
33 35
] + COMMANDS_IN_ALL_MODE
34 36

  
35 37
USAGE = """usage: %%prog [options] command[,command...]
......
42 44
    * %s: Run Synnefo unittests
43 45
    * %s: Run snf-burnin in the deployed Synnefo
44 46
    * %s: Create x2go plugin file
47
    * %s: Delete the slave server
45 48

  
46 49
    * %s: Run all the available commands
47 50
""" % tuple([CREATE_SERVER_CMD,
......
51 54
             TEST_SYNNEFO_CMD,
52 55
             RUN_BURNIN_CMD,
53 56
             CREATE_X2GO_FILE,
57
             DELETE_SERVER_CMD,
54 58
             ALL_CMDS])
55 59

  
56 60

  
......
166 170
        synnefo_ci.run_burnin()
167 171
    if getattr(options, CREATE_X2GO_FILE, False):
168 172
        synnefo_ci.x2go_plugin(options.x2go_output)
173
    if getattr(options, DELETE_SERVER_CMD, False):
174
        synnefo_ci.destroy_server()
169 175

  
170 176

  
171 177
if __name__ == "__main__":
b/ci/utils.py
253 253
    def destroy_server(self, wait=True):
254 254
        """Destroy slave server"""
255 255
        server_id = int(self.read_temp_config('server_id'))
256
        fips = [f for f in self.network_client.list_floatingips()
257
                if str(f['instance_id']) == str(server_id)]
256 258
        self.logger.info("Destoying server with id %s " % server_id)
257 259
        self.cyclades_client.delete_server(server_id)
258 260
        if wait:
259 261
            self._wait_transition(server_id, "ACTIVE", "DELETED")
262
        for fip in fips:
263
            self.logger.info("Destroying floating ip %s",
264
                             fip['floating_ip_address'])
265
            self.network_client.delete_floatingip(fip['id'])
260 266

  
261 267
    def _create_floating_ip(self):
262 268
        """Create a new floating ip"""

Also available in: Unified diff