       { permission: 'update own stack', validateWith: Validators.own }
     ]
 
-    success: (client, options, callback)->
+    success: (client, options, callback) ->
 
       { title, config } = options
 
       unless title or config
-        return callback new KodingError "Nothing to update"
+        return callback new KodingError 'Nothing to update'
 
       title  ?= @title
       config ?= @config
 
-      @update $set : { title, config }, (err)->
+      @update $set : { title, config }, (err) ->
         return callback err  if err?
         callback null
 


      status             :
        type             : String
        enum             : ["Wrong type specified!", [

          # States which description ending with '...' means its an ongoing
          # proccess which you may get progress info about it
          #
          "Initial"         # Initial state
          "Terminating"     # Stack is getting destroyed...
          "Terminated"      # Stack is destroyed, not exists anymore
        ]]

        default          : -> "Initial"


  @getStack = (account, _id, callback)->

    JComputeStack.one { _id, originId : account.getId() }, (err, stackObj)->
      if err? or not stackObj?
        return callback new KodingError "A valid stack id required"
      callback null, stackObj


  appendTo: (itemToAppend, callback)->

    # itemToAppend is like: { machines: machine.getId() }

    # TODO add check for itemToAppend to make sure its just ~ GG
    # including supported fields: [rules, domains, machines, extras]

    @update $addToSet: itemToAppend, (err)-> callback err


  ###*


  @some$ = permit 'list stacks',

    success: (client, selector, options, callback) ->

      [options, callback] = [callback, options]  unless callback
      options ?= {}
