[PA-721] URL Rewrite Rule is Vanagon source.rb always points to http://buildsources.delivery.puppetlabs.net Created: 2016/11/23  Updated: 2018/05/11  Resolved: 2018/05/11

Status: Closed
Project: Puppet Agent
Component/s: Build Automation, Packaging, Vanagon
Affects Version/s: puppet-agent 1.8.1
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: James Perry Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Red Hat Enterprise Linux Server release 7.2 (Maipo)
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)


Template:
Acceptance Criteria:

Bundler build of puppet-agent can be run outside of Puppet Labs to create the puppet-agent package for legacy servers, provided all compile time requirements are met.

Epic Link: Puppet Agent should be easily buildable by anybody
Team: Platform OS

 Description   

When running bundler exec build puppet-agent sles-10-x86_64 tlistmrsuse103 I kept failing with the below error after pulling in pxp-agent from Github.

_An error was encountered evaluating block. Retrying..
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/utilities.rb:176:in `retry_with_timeout': Block failed maximum number of 1 tries (SocketError)
with error getaddrinfo: Name or service not known
Exiting...
from /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/driver.rb:181:in `retry_task'
from /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/driver.rb:134:in `run'
from /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:28:in `block in <top (required)>'
from /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:25:in `each'
from /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:25:in `<top (required)>'
from /home/myhome/bin/build:23:in `load'
from /home/myhome/bin/build:23:in `<main>'
Block failed maximum number of 1 tries
with error getaddrinfo: Name or service not known
Exiting...
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/utilities.rb:176:in `retry_with_timeout'
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/driver.rb:181:in `retry_task'
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/driver.rb:134:in `run'
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:28:in `block in <top (required)>'
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:25:in `each'
/home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/bin/build:25:in `<top (required)>'
/home/myhome/bin/build:23:in `load'
/home/myhome/bin/build:23:in `<main>'_

Without any further details from the script I dug through the code to find that it was the Augeas component defined in puppet-agent/configs/projects/puppet-agent.rb where it failed, changing the order of Augeas in the proj.component list caused the failure to follow. This also happened when I swapped Augeas for Curl.

Further digging identified the problems as arising from the rewrite section of /home/myhome/lib/ruby/gems/2.1.0/gems/vanagon-0.8.2/lib/vanagon/component/source.rb. I put in quick puts statements to get output of what was happening.

jim: string_rewrite rule=http://buildsources.delivery.puppetlabs.net original_url=http://download.augeas.net/augeas-1.4.0.tar.gz url=http://download.augeas.net/augeas-1.4.0.tar.gz
jim: target_match =#<MatchData "http://download.augeas.net/augeas-1.4.0.tar.gz" 1:"augeas-1.4.0.tar.gz">
jim: if target_match
jim: target="augeas-1.4.0.tar.gz" rule=http://buildsources.delivery.puppetlabs.net

The code is re-writing the URL to be *http://buildsources.delivery.puppetlabs.net/augeas-1.4.0.tar.gz* instead of *http://download.augeas.net/augeas-1.4.0.tar.gz*.

Changing the return from return File.join(rule,target) to return url allows the build to proceed through download and compiling on the target host where it had been failing constantly before as I have no access to build this inside puppetlabs.net network.

Here is the modified block:
def string_rewrite(rule, original_url)
url = original_url.to_s
target_match = url.match(/.\/([^\/])$/)
if target_match
target = target_match[1]

  1. return File.join(rule, target)
    return url
    else
    raise Vanagon::Error, "Unable to apply url rewrite to '# {url}

    ', expected to find at least one '/' in the url."
    end
    end



 Comments   
Comment by Branan Riley [ 2018/05/11 ]

This should have been fixed by the migration from the URL rewrite system to the built-in mirror support in newer versions of Vanagon

Generated at Wed Apr 01 15:13:33 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.