    # File lib/fog/libvirt/models/compute/server.rb, line 167
            def setup(credentials = {})
              requires :public_key, :public_ip_address, :username

              credentials[:proxy]= ssh_proxy unless ssh_proxy.nil?
              credentials[:password] = password unless self.password.nil?
              credentails[:key_data] = [private_key] if self.private_key

              commands = [
                %{mkdir .ssh},
                #              %{passwd -l #{username}}, #Not sure if we need this here
                #              %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json}
              ]
              if public_key
                commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
              end

              # wait for domain to be ready
              Timeout::timeout(360) do
                begin
                  Timeout::timeout(8) do
                    Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')
                  end
                rescue Errno::ECONNREFUSED
                  sleep(2)
                  retry
                rescue Net::SSH::AuthenticationFailed, Timeout::Error
                  retry
                end
              end
              Fog::SSH.new(public_ip_address, username, credentials).run(commands)
            end