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

[enhancement] don't call facter from puppet #68

Closed
GeoffWilliams opened this issue Sep 28, 2018 · 4 comments
Closed

[enhancement] don't call facter from puppet #68

GeoffWilliams opened this issue Sep 28, 2018 · 4 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@GeoffWilliams
Copy link
Contributor

Calling facter from puppet is slow and takes several seconds. recommend moving the code in the custom fact that does reading to a shared library and just invoke it - this will save seconds

GeoffWilliams added a commit to GeoffWilliams/puppet_os_patching that referenced this issue Oct 23, 2018
* Shared library at `lib/os_patching/os_patching.rb`
* Extract all sharable code from tasks (`tasks/*.rb`) and move to shared library
* Move remaining task code to `tasks.real/*.rb` since tasks cannot reference
  shared libraries yet.
* Add an additional `Makefile` at `tasks/Makefile` to concatenate the shared
  library and task files together to provide files that puppet can use. You
  must run `cd tasks && make` each time to update the files before building
  a module release until Puppet Enterprise addresses this in the tasks product
* Remove all calls to `facter`/`puppet facts` and use the Ruby API instead, via
  shared library (fixes albatrossflavour#68)
* Rewrite `output()` function to iterate the passed in hash in order to allow
  single function to work for all tasks
* Ensure all calls to external programs have a timeout (10 seconds), slow
  running tasks (updates, cache cleans, fact refreshes) will use any supplied
  timeout or default to 3600 seconds (fixes albatrossflavour#94)
* Rewrite the custom fact code to obtain all data by calling a single function
  in the shared library
* Add a `timeout` parameter to the `clean_cache` and `refresh_fact` tasks
* Add a `debug` parameter to all tasks, Support writing to STDOUT when debug
  mode is enabled
* All big-ticket jobs get their own reusable function in the shared library (eg
  clean cache, update, refresh facts, etc)
* Extract in-lined code to shared functions to support:
  * `windows?` - Detecting Windows
  * `os_patching_dir` - Detecting state directory
  * `chunk_*` - Progressive fact generation
  * `history` - Writing the history file
  * `output` - Outputting error result
  * `err` - Outputting task error
  * `run_with_timeout` - Making system calls
  * `fact` - Generate whole fact
  * `get_logger` - Get logging instance
  * `get_params` - Parse params
  * `clean_cache` - Clean the cache
  * `refresh_facts` - Refresh the facts
  * `supported_platform` - Check we are running on a supported platform
  * `get_timeout` - Get any timeout requested by user or switch to default
* Document all functions in shared library (YARD/puppet strings)
GeoffWilliams added a commit to GeoffWilliams/puppet_os_patching that referenced this issue Oct 23, 2018
* Shared library at `lib/os_patching/os_patching.rb`
* Extract all sharable code from tasks (`tasks/*.rb`) and move to shared library
* Move remaining task code to `tasks.real/*.rb` since tasks cannot reference
  shared libraries yet.
* Add an additional `Makefile` at `tasks/Makefile` to concatenate the shared
  library and task files together to provide files that puppet can use. You
  must run `cd tasks && make` each time to update the files before building
  a module release until Puppet Enterprise addresses this in the tasks product
* Remove all calls to `facter`/`puppet facts` and use the Ruby API instead, via
  shared library (fixes albatrossflavour#68)
* Rewrite `output()` function to iterate the passed in hash in order to allow
  single function to work for all tasks
* Ensure all calls to external programs have a timeout (10 seconds), slow
  running tasks (updates, cache cleans, fact refreshes) will use any supplied
  timeout or default to 3600 seconds (fixes albatrossflavour#94)
* Rewrite the custom fact code to obtain all data by calling a single function
  in the shared library
* Add a `timeout` parameter to the `clean_cache` and `refresh_fact` tasks
* Add a `debug` parameter to all tasks, Support writing to STDOUT when debug
  mode is enabled
* All big-ticket jobs get their own reusable function in the shared library (eg
  clean cache, update, refresh facts, etc)
* Extract in-lined code to shared functions to support:
  * `windows?` - Detecting Windows
  * `os_patching_dir` - Detecting state directory
  * `chunk_*` - Progressive fact generation
  * `history` - Writing the history file
  * `output` - Outputting error result
  * `err` - Outputting task error
  * `run_with_timeout` - Making system calls
  * `fact` - Generate whole fact
  * `get_logger` - Get logging instance
  * `get_params` - Parse params
  * `clean_cache` - Clean the cache
  * `refresh_facts` - Refresh the facts
  * `supported_platform` - Check we are running on a supported platform
  * `get_timeout` - Get any timeout requested by user or switch to default
* Document all functions in shared library (YARD/puppet strings)
GeoffWilliams added a commit to GeoffWilliams/puppet_os_patching that referenced this issue Oct 23, 2018
* Shared library at `lib/os_patching/os_patching.rb`
* Extract all sharable code from tasks (`tasks/*.rb`) and move to shared library
* Move remaining task code to `tasks.real/*.rb` since tasks cannot reference
  shared libraries yet.
* Add an additional `Makefile` at `tasks/Makefile` to concatenate the shared
  library and task files together to provide files that puppet can use. You
  must run `cd tasks && make` each time to update the files before building
  a module release until Puppet Enterprise addresses this in the tasks product
* Remove all calls to `facter`/`puppet facts` and use the Ruby API instead, via
  shared library (fixes albatrossflavour#68)
* Rewrite `output()` function to iterate the passed in hash in order to allow
  single function to work for all tasks
* Ensure all calls to external programs have a timeout (10 seconds), slow
  running tasks (updates, cache cleans, fact refreshes) will use any supplied
  timeout or default to 3600 seconds (fixes albatrossflavour#94)
* Rewrite the custom fact code to obtain all data by calling a single function
  in the shared library
* Add a `timeout` parameter to the `clean_cache` and `refresh_fact` tasks
* Add a `debug` parameter to all tasks, Support writing to STDOUT when debug
  mode is enabled
* All big-ticket jobs get their own reusable function in the shared library (eg
  clean cache, update, refresh facts, etc)
* Extract in-lined code to shared functions to support:
  * `windows?` - Detecting Windows
  * `os_patching_dir` - Detecting state directory
  * `chunk_*` - Progressive fact generation
  * `history` - Writing the history file
  * `output` - Outputting error result
  * `err` - Outputting task error
  * `run_with_timeout` - Making system calls
  * `fact` - Generate whole fact
  * `get_logger` - Get logging instance
  * `get_params` - Parse params
  * `clean_cache` - Clean the cache
  * `refresh_facts` - Refresh the facts
  * `supported_platform` - Check we are running on a supported platform
  * `get_timeout` - Get any timeout requested by user or switch to default
* Document all functions in shared library (YARD/puppet strings)
@TJM
Copy link

TJM commented Aug 9, 2019

I think this can be closed per #95 too.

@maxadamo
Copy link
Contributor

any idea if this one will be implemented? It will also solve #190
it stopped working with puppet 7 and facter -p puppet_vardir does not work any longer.

@GeoffWilliams GeoffWilliams changed the title [enhancement] don't call facter from puppet [assign geoff] [enhancement] don't call facter from puppet Jan 25, 2021
@GeoffWilliams
Copy link
Contributor Author

@albatrossflavour

@albatrossflavour albatrossflavour added the wontfix This will not be worked on label May 9, 2021
@albatrossflavour albatrossflavour self-assigned this May 9, 2021
@albatrossflavour
Copy link
Owner

Going to be addressed as part of the rework for puppet 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants