Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-5615

vcsrepo : Check out fails due to "svn status" always returning exit code '0'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: vcsrepo
    • Labels:
    • Environment:

      CentOS Linux release 7.3.1611 (Core)

    • Template:
      MODULES Bug Template
    • Epic Link:
    • Team:
      Modules
    • Method Found:
      Manual Test
    • QA Risk Assessment:
      Needs Assessment

      Description

      Module Version: 2.0.0
      Puppet Version: 4.10.7
      SVN Version: 1.7.14 (subversion-1.7.14-10.el7.x86_64)
      OS Name/Version: CentOS Linux release 7.3.1611 (Core)

      Desired Behavior: With "ensure => present", if path exists, but is not a working copy, vcsrepo should check out from source to path.

      Actual Behavior: vcsrepo does not check out, but Puppet run fails with:
      (/Vcsrepo[/path/in/question]) Could not evaluate: Execution of '/usr/bin/svn --non-interactive --username USERNAME --password PASSWORD --no-auth-cache info' returned 1: svn: E155007: '/path/in/question' is not a working copy

      I dug through the provider and found that in "vcsrepo/lib/puppet/provider/vcsrepo/svn.rb", "def working_copy_exists?" tries to find out if path is a working copy by using "svn status /path/in/question". If it fails (not a working copy), the method returns false, if it succeeds it returns true.

      However, "svn status /path/in/question" always returns exit code '0', regardless if it's a working copy or not. Example:
      $ svn status /path/in/question; echo $?
      svn: warning: '/path/in/question' is not a working copy
      0

      Forcing the method to always return 'false' makes the provider function as expected.

      This is most likely an issue with "svn status" using exit codes incorrectly, but maybe vcsrepo can be changed to check for "is not a working copy" instead?

      vcsrepo/lib/puppet/provider/vcsrepo/svn.rb

        def working_copy_exists?
          return false if not File.directory?(@resource.value(:path))
          if @resource.value(:source)
            begin
              svn('status', @resource.value(:path)) # <-- This always succeeds due to "svn status" always exiting with '0'
              return true
            rescue Puppet::ExecutionFailure
              return false
            end
          else
            begin
              svnlook('uuid', @resource.value(:path))
              return true
            rescue Puppet::ExecutionFailure
              return false
            end
          end
        end
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            martin.morch@ipnordic.dk Martin Moerch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support