Skip to content

Support regex status types in http.query state#50150

Merged
cachedout merged 3 commits into
saltstack:developfrom
mchugh19:httpquery_statusreg
Oct 22, 2018
Merged

Support regex status types in http.query state#50150
cachedout merged 3 commits into
saltstack:developfrom
mchugh19:httpquery_statusreg

Conversation

@mchugh19
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds status_type to http.query state to support pcre expressions

What issues does this PR fix or reference?

#50067

New Behavior

Supports states like the following (note status_type and status)

{% set statuses = [200, 201] %}
{% for status in statuses %}
verifty_status_{{ status }}:
  http.query:
    - name: http://the-internet.herokuapp.com/status_codes/{{ status }}
    - status: 200|201
    - status_type: pcre
    - match: "This page returned a"
{% endfor %}

Tests written?

Yes

Commits signed with GPG?

No

Comment thread salt/states/http.py
else:
ret['comment'] += ' Status {0} was not found.'.format(status)
ret['result'] = False
elif status_type == 'pcre':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine this with the check for the string status type? It looks like the blocks are basically identical.

@cachedout cachedout merged commit 0a6e3d2 into saltstack:develop Oct 22, 2018
garethgreenaway added a commit to garethgreenaway/salt that referenced this pull request Sep 18, 2019
@waynew waynew added the has master-port port to master has been created label Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has master-port port to master has been created

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants