Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) Fix expect_upload for module relative paths outside files #3238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 29, 2023

  1. (maint) Fix expect_upload for module relative paths outside files

    The expect_upload() BoltSpec expectation for upload_file calls in plans
    handled two cases:
    
    Given a /my/modules/amodule with
    
      /my/modules/amodule/files/foo
      /my/modules/amodule/resources/baz
      /my/modules/amodule/plans/bar
    
    expect_upload('/some/thing') would correctly match against an
    upload_file('/some/thing') in plan bar, because it is not relative to
    the modulepath at all, and against an upload_file('amodule/foo'),
    because it is relative to amodule, and foo is relative to files,
    which expect_upload elides when the MockExecutor runs the source_path
    through BotlSpec::MockExecutor#module_file_id.
    
    The edge case that was peculiar was a call to
    upload_file('amodule/files/../resources/baz'), which expect_upload
    would end up expecting as 'amodule/baz'.
    
    The hidden behavior here is that Bolt::Util.find_file* functionality
    will take 'foo/bar' and look for /modulepath/foo/files/bar, which is
    mirroring Puppety behavior to find module files relative to the files/
    dir.
    jpartlow committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    19f0469 View commit details
    Browse the repository at this point in the history