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

Add parameter update_command_path #13

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

Conversation

treydock
Copy link
Contributor

Add update_command_path parameter that defaults value is the value of $update_command
Allows a custom update command to be used that is more than just the path to wrapper script

@adamcrews
Copy link
Owner

I'm not opposed to this, but I don't understand the use case. Why would you want to run the update command with different arguments than what is found in the config file? The update command is only executed upon package install, so my assumption is that the update command should run the same way it will run out of the update schedule.

The way I would approach this sort of issue would be to have some profile code that turns off the update on install, then runs the custom command.

In lieu of that, I think it might be better to rework this to have the update command accept an argument, rather than completely replace the command.

@treydock
Copy link
Contributor Author

The use case is sort of unique. I have Puppet managing systems that are NFS root and this NFS root system is the read/write host for read-only NFS systems. The read-only systems can't run updatedb since /var/lib/mlocate is read-only. The cron task will exist on read-only systems but I use some custom facts and logic to prevent the cron task from running:

  $update_command_path = hiera('mlocate::update_command_path', '/usr/local/bin/mlocate.cron')

  # Do things a bit differently on nfsroot RW hosts
  if str2bool("$::nfsroot") and ! str2bool("$::nfsroot_ro") {
    $_update_command = "[ \"x$(facter -p osc_host_type)\" = \"xrw\" ] && ${update_command_path}"
  } else {
    $_update_command = undef
  }

  class { '::mlocate':
    update_command => $_update_command,
  }

  Add update_command_path parameter that defaults value is the value of $update_command
  Allows a custom update command to be used that is more than just the path to wrapper script
@treydock
Copy link
Contributor Author

Rebased pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants