Class: Kitchen::Provisioner::Habitat
- Inherits:
-
Base
- Object
- Base
- Kitchen::Provisioner::Habitat
- Defined in:
- lib/kitchen/provisioner/habitat.rb
Instance Method Summary collapse
- #create_sandbox ⇒ Object
- #finalize_config!(instance) ⇒ Object
- #init_command ⇒ Object
- #install_command ⇒ Object
- #prepare_command ⇒ Object
- #run_command ⇒ Object
Instance Method Details
#create_sandbox ⇒ Object
95 96 97 98 99 |
# File 'lib/kitchen/provisioner/habitat.rb', line 95 def create_sandbox super copy_results_to_sandbox copy_user_toml_to_sandbox end |
#finalize_config!(instance) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/kitchen/provisioner/habitat.rb', line 53 def finalize_config!(instance) # Check to see if a package ident was specified for package name and be helpful unless (config[:package_name] =~ /\//).nil? config[:package_origin], config[:package_name], config[:package_version], config[:package_release] = config[:package_name].split('/') end unless config[:hab_sup_artifact_name].nil? ident = artifact_name_to_package_ident_regex.match(config[:hab_sup_artifact_name]) config[:hab_sup_origin] = ident["origin"] config[:hab_sup_name] = ident["name"] config[:hab_sup_version] = ident["version"] config[:hab_sup_release] = ident["release"] end unless config[:artifact_name].nil? ident = artifact_name_to_package_ident_regex.match(config[:artifact_name]) config[:package_origin] = ident["origin"] config[:package_name] = ident["name"] config[:package_version] = ident["version"] config[:package_release] = ident["release"] end super(instance) end |
#init_command ⇒ Object
91 92 93 |
# File 'lib/kitchen/provisioner/habitat.rb', line 91 def init_command wrap_shell_code 'id -u hab >/dev/null 2>&1 || sudo useradd hab >/dev/null 2>&1' end |
#install_command ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/kitchen/provisioner/habitat.rb', line 78 def install_command raise 'Need to fill in some implementation here.' if instance.platform == 'windows' wrap_shell_code <<-BASH #{export_hab_origin} if command -v hab >/dev/null 2>&1 then echo "Habitat CLI already installed." else curl 'https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh' | sudo bash fi BASH end |
#prepare_command ⇒ Object
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/kitchen/provisioner/habitat.rb', line 101 def prepare_command wrap_shell_code <<-EOH #{export_hab_origin} #{install_supervisor_command} #{binlink_supervisor_command} #{install_service_package} #{remove_previous_user_toml} #{copy_user_toml_to_service_directory} EOH end |
#run_command ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/kitchen/provisioner/habitat.rb', line 112 def run_command run = <<-RUN #{export_hab_origin} #{clean_up_screen_sessions} #{clean_up_previous_supervisor} echo "Running #{package_ident}." #{run_package_in_background} RUN wrap_shell_code run end |