Permalink
Show file tree
Hide file tree
5 changes: 2 additions & 3 deletions
5
lib/puppet/file_serving/indirection_hooks.rb → lib/puppet/file_serving/terminus_selector.rb
23 changes: 11 additions & 12 deletions
23
...it/file_serving/indirection_hooks_spec.rb → ...it/file_serving/terminus_selector_spec.rb
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add Selector terminus for file_content/file_metadata
This terminus is now the default, and encapsulates the behavior that was previously in the IndirectionHooks. That is, we dynamically select the terminus to use for a file request based on the key. However, for the puppet master, we instead explicitly always use the FileServer terminus, so that *all* requests for files from the master will go through the file server. This ensures that we will never accidentally serve local files on the puppet master.
- Loading branch information
Showing
11 changed files
with
78 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| require 'puppet/indirector/file_content' | ||
| require 'puppet/indirector/code' | ||
| require 'puppet/file_serving/terminus_selector' | ||
|
|
||
| class Puppet::Indirector::FileContent::Selector < Puppet::Indirector::Code | ||
| desc "Select the terminus based on the request" | ||
| include Puppet::FileServing::TerminusSelector | ||
|
|
||
| def get_terminus(request) | ||
| indirection.terminus(select(request)) | ||
| end | ||
|
|
||
| def find(request) | ||
| get_terminus(request).find(request) | ||
| end | ||
|
|
||
| def search(request) | ||
| get_terminus(request).search(request) | ||
| end | ||
|
|
||
| def authorized?(request) | ||
| terminus = get_terminus(request) | ||
| if terminus.respond_to?(:authorized?) | ||
| terminus.authorized?(request) | ||
| else | ||
| true | ||
| end | ||
| end | ||
| end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| require 'puppet/indirector/file_metadata' | ||
| require 'puppet/indirector/code' | ||
| require 'puppet/file_serving/terminus_selector' | ||
|
|
||
| class Puppet::Indirector::FileMetadata::Selector < Puppet::Indirector::Code | ||
| desc "Select the terminus based on the request" | ||
| include Puppet::FileServing::TerminusSelector | ||
|
|
||
| def get_terminus(request) | ||
| indirection.terminus(select(request)) | ||
| end | ||
|
|
||
| def find(request) | ||
| get_terminus(request).find(request) | ||
| end | ||
|
|
||
| def search(request) | ||
| get_terminus(request).search(request) | ||
| end | ||
|
|
||
| def authorized?(request) | ||
| terminus = get_terminus(request) | ||
| if terminus.respond_to?(:authorized?) | ||
| terminus.authorized?(request) | ||
| else | ||
| true | ||
| end | ||
| end | ||
| end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters