Class: Cyclid::API::Plugins::Debian
- Inherits:
-
Provisioner
- Object
- Base
- Provisioner
- Cyclid::API::Plugins::Debian
- Defined in:
- app/cyclid/plugins/provisioner/debian.rb
Overview
Debian provisioner
Instance Method Summary collapse
-
#prepare(transport, buildhost, env = {}) ⇒ Object
Prepare a Debian based build host.
Methods inherited from Provisioner
Methods inherited from Base
config?, config_schema, default_config, get_config, human_name, register_plugin, set_config, update_config
Instance Method Details
#prepare(transport, buildhost, env = {}) ⇒ Object
Prepare a Debian based build host
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/cyclid/plugins/provisioner/debian.rb', line 25 def prepare(transport, buildhost, env = {}) transport.export_env('DEBIAN_FRONTEND' => 'noninteractive') # Build hosts may require an update before anything can be installed success = transport.exec 'apt-get update -qq' raise 'failed to update repositories' unless success if env.key? :repos env[:repos].each do |repo| next unless repo.key? :url url = repo[:url] match = url.match(/\A(http|https):.*\Z/) next unless match case match[1] when 'http', 'https' add_http_repository(transport, url, repo, buildhost) end end # We must update again to cache the new repositories success = transport.exec 'apt-get update -q' raise 'failed to update repositories' unless success end if env.key? :packages success = transport.exec \ "apt-get install -q -y #{env[:packages].join(' ')}" \ raise "failed to install packages #{env[:packages].join(' ')}" unless success end rescue StandardError => ex Cyclid.logger.error "failed to provision #{buildhost[:name]}: #{ex}" raise end |