<commit_before>require 'fog/compute/models/server'

module Fog
  module Compute
    class OpenNebula
      class Server < Fog::Compute::Server
        identity :id
	attribute :template_str
	attribute :name
	attribute :uuid
	attribute :state
	attribute :status
	attribute :ip
	attribute :mac
	attribute :vcpu
	attribute :cpu
	attribute :memory
	attribute :user
	attribute :gid
	attribute :group
	attribute :onevm_object
	attribute :flavor

        def save
          #if persisted?
          #  service.update_vm(attributes)
          #else
            merge_attributes(service.vm_allocate(attributes))
          #end
          #reload
        end

	def interfaces
		#[] << Fog::Compute::OpenNebula::Interfaces.new
		[]
	end

	def interfaces_attributes=(attributes)
		true
	end

	def vm_ip_address
	  ip
	end


        def private_ip_address
	  ip
	end

	def public_ip_address
	  ip
	end

	def vm_mac_address
	  mac
	end
	
	def start
		if status == 4
		  service.vm_resume(id)
		end
	        return true
	end	

	def stop
	Fog::Logger.warning("stop VM: ID:#{id}")
	  service.vm_stop(id)
	end

        def destroy
          service.vm_destroy(id)
        end

        def ready?
	  (status == 3) 
        end
	
	def template_id
	  4
	end

	def console_output
          requires :id
	  service.get_vnc_console(id, "vnc", onevm_object)
	end


      end
    end
  end
end<commit_msg>[opennebula] fixed indentation<commit_after>require 'fog/compute/models/server'

module Fog
  module Compute
    class OpenNebula
      class Server < Fog::Compute::Server
        identity :id
        attribute :template_str
        attribute :name
        attribute :uuid
        attribute :state
        attribute :status
        attribute :ip
        attribute :mac
        attribute :vcpu
        attribute :cpu
        attribute :memory
        attribute :user
        attribute :gid
        attribute :group
        attribute :onevm_object
        attribute :flavor

        def save
          #if persisted?
          #  service.update_vm(attributes)
          #else
            merge_attributes(service.vm_allocate(attributes))
          #end
          #reload
        end

        def interfaces
          #[] << Fog::Compute::OpenNebula::Interfaces.new
          []
        end

        def interfaces_attributes=(attributes)
          true
        end

        def vm_ip_address
          ip
        end

        def private_ip_address
          ip
        end

        def public_ip_address
          ip
        end

        def vm_mac_address
          mac
        end

        def start
          if status == 4
            service.vm_resume(id)
          end
          return true
        end	

        def stop
          Fog::Logger.warning("stop VM: ID:#{id}")
          service.vm_stop(id)
        end

        def destroy
          service.vm_destroy(id)
        end

        def ready?
          (status == 3) 
        end

        # dummy method - used by a rails-view to get the id of the default template, but i have no clou what a global default should be
        # method should be remove here
        def template_id
          1
        end

        def console_output
          requires :id
          service.get_vnc_console(id, "vnc", onevm_object)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.060431217734588524, 'fraction_numerical': 0.0018220467658669906, 'mean_word_length': 1.6977886977886978, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7547500', 'n_tokens_mistral': 996, 'n_tokens_neox': 935, 'n_words': 269}