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

check_powershell and integrate into chocolatey::install #3

Open
7 of 8 tasks
DavidS opened this issue Apr 7, 2021 · 1 comment
Open
7 of 8 tasks

check_powershell and integrate into chocolatey::install #3

DavidS opened this issue Apr 7, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@DavidS
Copy link
Contributor

DavidS commented Apr 7, 2021

check_powershell runs a powershell command and evaluates the output and return values to determine success or failure. To provide the best flexibility, this resource provides parameters to retry executions.

  • Add ruby-pwsh to the opv module's dependencies. (.sync.yml; pdk update)

  • Create new check_powershell resource.

  • Update check_powershell type to have the following attributes:

    • command, namevar, String: The powershell command to run.

    • expected_exitcode, parameter, Array[Number]: an array of acceptable exit codes. Defaults to [0]

    • output_matcher, parameter, Regexp: a call is considered a success if its output matches this regular expression. Defaults to //

    • execution_timeout, parameter, Numeric: number of seconds for a single execution to wait for a response to return a success before aborting, defaults to 60

    • retries, parameter, Integer: number of requests to make before giving up, defaults to 1

    • backoff, parameter, Numeric: initial number of seconds to wait between requests, defaults to 10

    • exponential_backoff_base, parameter, Numeric: exponential base for the exponential backoff calculations, defaults to 2

    • max_backoff, parameter, Numeric: an upper limit to the backoff duration, defaults to 120

    • timeout, parameter, Numeric: number of seconds allocated overall for the check to return a success before giving up, defaults to 600

  • Update the check_http provider to use the insync? feature from Allow custom insync? checking for resources puppet-resource_api#225 to be quiet (in sync) when the check succeeds, and report a regular error otherwise. See a7f60f2 for an example.

  • Update the check_powershell provider to use the above attributes to execute the command up to retries number of times with success being defined as having one of the expected_statuses and the output of the command matching output_matcher while taking into account execution_timeout.

  • Update the check_powershell provider to wait for backoff ** (exponential_backoff_base * (number_of_attempt - 1) seconds between attempts (up to max_backoff), but aborting completely after timeout seconds if no successful request could be made. Investigate combining this retry implementation with the one in check_http and integrate into apache::vhost #1.

  • Update the check_powershell provider to log detailed messages at the debug level of execution, output and backoff waits.

  • Create a PR on the puppetlabs/chocolatey module to integrate the check_powershell into chocolatey::install to verify that choco can be executed. Do not merge that PR as this is still experimental work.

Each change needs to be accompanied with appropriate unit and (changes to) acceptance tests proving the functionality.

@DavidS DavidS added [zube]: Inbox enhancement New feature or request and removed [zube]: Inbox labels Apr 7, 2021
@sheenaajay sheenaajay self-assigned this Jun 22, 2021
@sheenaajay
Copy link
Contributor

Added required dependencies to the sync.yaml file
Created the check_powershell resource type
Created the check_powershell resource provider
Currently testing the provider

sheenaajay added a commit to sheenaajay/opv that referenced this issue Jun 30, 2021
sheenaajay added a commit to sheenaajay/opv that referenced this issue Jul 1, 2021
sheenaajay added a commit to sheenaajay/opv that referenced this issue Jul 1, 2021
sheenaajay added a commit to sheenaajay/opv that referenced this issue Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants