Module: Skytapify::ActsAsSkytapConfig::LocalInstanceMethods
- Defined in:
- lib/skytapify/acts_as_skytap_config.rb
Instance Method Summary collapse
- #generate_new_config ⇒ Object
- #get_config ⇒ Object
- #halt_vm(vm_id) ⇒ Object
- #refresh_configuration ⇒ Object
- #regenerate_schedules ⇒ Object
- #runstate ⇒ Object
- #runstate=(new_state) ⇒ Object
Instance Method Details
#generate_new_config ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 17 def generate_new_config begin build_configuration(lab.template_id, "#{user.try(:first_name)} #{user.try(:last_name)} - #{lab.name}") assign_configuration(user.skytap_id) if user.skytap_id.present? rename_configuration_vms build_publish_sets(lab.publish_set_access) build_start_stop_schedule if lab.next_start_datetime build_auto_delete_schedule if lab.auto_delete rescue => e delete_configuration raise RuntimeError, e end end |
#get_config ⇒ Object
32 33 34 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 32 def get_config configuration_id ? api_call(organization, "configuration show #{configuration_id}") : false end |
#halt_vm(vm_id) ⇒ Object
44 45 46 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 44 def halt_vm(vm_id) configuration_id ? api_call(organization, "vm update #{vm_id}", {runstate: 'halted'}) : false end |
#refresh_configuration ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 48 def refresh_configuration if configuration_id delete_vms add_vms_from_template(lab.template_id) add_vms_to_publish_sets(lab.publish_set_access) rename_configuration_vms else generate_new_config_without_delay end end |
#regenerate_schedules ⇒ Object
59 60 61 62 63 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 59 def regenerate_schedules delete_all_schedules build_start_stop_schedule if lab.next_start_datetime build_auto_delete_schedule if lab.auto_delete end |
#runstate ⇒ Object
36 37 38 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 36 def runstate configuration_id ? get_config['runstate'] : false end |
#runstate=(new_state) ⇒ Object
40 41 42 |
# File 'lib/skytapify/acts_as_skytap_config.rb', line 40 def runstate=(new_state) configuration_id ? api_call(organization, "configuration update #{configuration_id}", {runstate: new_state}) : false end |