Module: Staypuft::Concerns::HostOpenStackAffiliation

Extended by:
ActiveSupport::Concern
Defined in:
app/models/staypuft/concerns/host_open_stack_affiliation.rb

Instance Method Summary collapse

Instance Method Details

#open_stack_assigned?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'app/models/staypuft/concerns/host_open_stack_affiliation.rb', line 34

def open_stack_assigned?
  respond_to?(:hostgroup) &&
      hostgroup.try(:parent).try(:parent) == Hostgroup.get_base_hostgroup
end

#open_stack_deployed?Boolean

Returns:

  • (Boolean)


23
24
25
26
# File 'app/models/staypuft/concerns/host_open_stack_affiliation.rb', line 23

def open_stack_deployed?
  !deployment.nil? && !deployment.in_progress? &&
  open_stack_environment_set? && open_stack_assigned?
end

#open_stack_environment_set?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'app/models/staypuft/concerns/host_open_stack_affiliation.rb', line 28

def open_stack_environment_set?
  open_stack_assigned? &&
  respond_to?(:environment) &&
  environment != Environment.get_discovery
end

#open_stack_unassignObject



39
40
41
42
# File 'app/models/staypuft/concerns/host_open_stack_affiliation.rb', line 39

def open_stack_unassign
  self.hostgroup = nil
  save!
end