Uploaded image for project: 'Puppet Agent'
  1. Puppet Agent
  2. PA-721

URL Rewrite Rule is Vanagon source.rb always points to http://buildsources.delivery.puppetlabs.net

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: puppet-agent 1.8.1
    • Fix Version/s: None
    • Labels:
      None
    • 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:
      Hide

      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.

      Show
      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.
    • 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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jjperry69 James Perry
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support