Class: Vanagon::Platform::RPM::SLES

Inherits:
Vanagon::Platform::RPM show all
Defined in:
lib/vanagon/platform/rpm/sles.rb

Overview

SLES is special, mainly in the differences between yum and zypper, so here we subclass SLES off of rpm.

Constant Summary

Constants inherited from Vanagon::Platform

PLATFORM_REGEX, VERSION_REGEX

Instance Attribute Summary

Attributes inherited from Vanagon::Platform

#abs_resource_name, #architecture, #aws_ami, #aws_instance_type, #aws_key, #aws_key_name, #aws_region, #aws_shutdown_behavior, #aws_subnet_id, #aws_user_data, #aws_vpc_id, #brew, #build_dependencies, #build_hosts, #cflags, #codename, #copy, #cross_compiled, #defaultdir, #dist, #docker_image, #docker_run_args, #environment, #find, #install, #ldflags, #make, #mktemp, #name, #num_cores, #os_name, #os_version, #output_dir, #package_type, #patch, #platform_triple, #provisioning, #rpmbuild, #sed, #servicedir, #servicetype, #servicetypes, #settings, #shasum, #shell, #sort, #source_output_dir, #ssh_port, #tar, #target_user, #use_docker_exec, #valid_operators, #vmpooler_template

Instance Method Summary collapse

Methods inherited from Vanagon::Platform::RPM

#generate_package, #generate_packaging_artifacts, #initialize, #output_dir, #package_name, #package_override, #rpm_defines, #source_output_dir

Methods inherited from Vanagon::Platform

#[], #add_build_repository, #add_group, #add_user, #generate_compiled_archive, #get_service_dir, #get_service_types, #initialize, #is_aix?, #is_amazon?, #is_cisco_wrlinux?, #is_cross_compiled?, #is_cross_compiled_linux?, #is_deb?, #is_debian?, #is_el8?, #is_el?, #is_eos?, #is_fedora?, #is_fips?, #is_huaweios?, #is_linux?, #is_macos?, #is_osx?, #is_rpm?, #is_sles?, #is_solaris?, #is_ubuntu?, #is_unix?, #is_windows?, load_platform, #package_override, #provision_with, #validate_operator, #version_munger

Methods included from HashableAttributes

#to_hash, #to_json

Methods included from Utilities

#erb_file, #erb_string, #ex, #find_program_on_path, #get_md5sum, #get_sum, #http_request, #http_request_code, #http_request_generic, #local_command, #remote_ssh_command, #retry_with_timeout, #rsync_from, #rsync_to, #ssh_command

Constructor Details

This class inherits a constructor from Vanagon::Platform::RPM

Instance Method Details

#add_repository(definition) ⇒ Array

Helper to setup a zypper repository on a target system

Parameters:

  • definition (String)

    the repo setup URI or RPM file

Returns:

  • (Array)

    A list of commands to add a zypper repo for the build system



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vanagon/platform/rpm/sles.rb', line 11

def add_repository(definition)
  definition = URI.parse(definition)
  if @os_version == '10'
    flag = 'sa'
  else
    flag = 'ar'
  end

  commands = []

  if definition.scheme =~ /^(http|ftp)/
    if File.extname(definition.path) == '.rpm'
      # repo definition is an rpm (like puppetlabs-release)
      commands << "curl --silent --show-error --fail -o local.rpm '#{definition}'; rpm -Uvh local.rpm; rm -f local.rpm"
    else
      commands << "yes | zypper -n --no-gpg-checks #{flag} -t YUM --repo '#{definition}'"
    end
  end

  commands
end