           
           cmd.on 'close', (code) ->
             console.log 'unzip process exited with code ', code
+            manifestFilePath = path.join(kitePath, kiteName, "manifest.json")
+            content = JSON.parse fs.readFileSync(manifestFilePath)
+            content.version = version
+            fs.writeFileSync manifestFilePath, JSON.stringify(content)
             callback()
 
   runKite: () ->

      callback()

  downloadAndExtractKite: (callback) ->
    {kitePath, zipUrl, kiteName} = this
    fs.mkdirsSync(kitePath) ## TODO mkdir creates 0777, exists check
    
    filepath = path.join kitePath, "#{kiteName}.zip"


class Deployment
  @pathToContainers = "/var/lib/lxc"
  constructor: (@kiteName, @version, @zipUrl) ->
    @kitePath = path.join Deployment.pathToContainers, "#{@kiteName}-#{@version}", "overlay", "opt", "kites"

  createLxc: (callback) ->
    cmd = spawn "create-lxc", [@kiteName]
