       response.on "end", () ->
         console.log "file download complete", response.statusCode
         if response.statusCode is 200
-          console.log "chdirpath", kitePath
-          process.chdir kitePath
-          
-          cmd = spawn "unzip", ["#{name}.zip"]
-
+          cmd = spawn "unzip", [ path.join(@kitesPath, "#{kiteName}.zip"), "-d", @kitesPath]
           console.log 'unziping kite'
           
           cmd.stdout.on 'data', (data) ->

fs       = require 'fs-extra'
path     = require 'path'

class LXC
  
  constructor: (@name) ->
    @pathToContainers = "/var/lib/lxc"
    console.log "......LXC constructor",  @name

  createLxc: (callback) ->
    cmd = spawn "create-lxc", [@name]
    console.log 'create lxc'
    cmd.stdout.on 'data', (data) ->
      console.log 'stdout: ', data.toString()

          
          cmd.on 'close', (code) ->
            console.log 'unzip process exited with code ', code
            callback()

  runKite: () ->
    kiteInLxc = path.join "/opt", "kites", @kiteName
    runner    = path.join(@pathToContainers, @name, "overlay", "opt", "runner")
    fs.writeFileSync runner, "#!/bin/bash -l \n export HOME=/root \n /usr/sbin/kd.sh #{kiteInLxc} > /tmp/kd.out & \n"
    fs.chmodSync runner, "0755"
    cmd = spawn "/usr/bin/lxc-start", ["-d", "-n", @name]
    
    cmd.stdout.on 'data', (data) ->
