-
Notifications
You must be signed in to change notification settings - Fork 339
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
inventory aws_ec2 - add support for AND logic #1365
base: main
Are you sure you want to change the base?
inventory aws_ec2 - add support for AND logic #1365
Conversation
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: You can compare to the docs for the File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ec2_inventory.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ec2_inventory.html
index f3c667d..dcb4db7 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ec2_inventory.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ec2_inventory.html
@@ -218,6 +218,32 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-apply_and_logic_on_exclude_filters"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-apply-and-logic-on-exclude-filters"><strong>apply_and_logic_on_exclude_filters</strong></p>
+<a class="ansibleOptionLink" href="#parameter-apply_and_logic_on_exclude_filters" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><span class="ansible-option-versionadded">added in amazon.aws 6.0.0</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>When multiple filters are specified on the <code class="docutils literal notranslate"><span class="pre">exclude_filters</span></code>, the filters are joined with an AND, if this parameter is set to <em>true</em> therefore any instances matching all of the filters are excluded from the result.</p>
+<p class="ansible-option-line"><span class="ansible-option-choices">Choices:</span></p>
+<ul class="simple">
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><span class="pre">false</span></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-apply_and_logic_on_include_filters"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-apply-and-logic-on-include-filters"><strong>apply_and_logic_on_include_filters</strong></p>
+<a class="ansibleOptionLink" href="#parameter-apply_and_logic_on_include_filters" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><span class="ansible-option-versionadded">added in amazon.aws 6.0.0</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>When multiple filters are specified on the <code class="docutils literal notranslate"><span class="pre">include_filters</span></code> and <code class="docutils literal notranslate"><span class="pre">filters</span></code> keys, the filters are joined with an AND, if this parameter is set to <em>true</em> therefore only instances matching all of the specified filters are returned in the result.</p>
+<p class="ansible-option-line"><span class="ansible-option-choices">Choices:</span></p>
+<ul class="simple">
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><span class="pre">false</span></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-assume_role_arn"></div>
<div class="ansibleOptionAnchor" id="parameter-iam_role_arn"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-iam-role-arn"><span id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-assume-role-arn"></span><strong>assume_role_arn</strong></p>
<a class="ansibleOptionLink" href="#parameter-assume_role_arn" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: iam_role_arn</span></p>
@@ -383,7 +409,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
<td><div class="ansible-option-cell"><p>A list of filters. Any instances matching one of the filters are excluded from the result.</p>
<p>The filters from <code class="docutils literal notranslate"><span class="pre">exclude_filters</span></code> take priority over the <code class="docutils literal notranslate"><span class="pre">include_filters</span></code> and <code class="docutils literal notranslate"><span class="pre">filters</span></code> keys</p>
<p>Available filters are listed here <a class="reference external" href="http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options">http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options</a>.</p>
-<p>Every entry in this list triggers a search query. As such, from a performance point of view, it’s better to keep the list as short as possible.</p>
+<p>Every entry in this list triggers a search query if <code class="docutils literal notranslate"><span class="pre">apply_and_logic_on_exclude_filters</span></code> is not set to <em>true</em>. As such, from a performance point of view, it’s better to keep the list as short as possible.</p>
<p class="ansible-option-line"><span class="ansible-option-default-bold">Default:</span> <code class="ansible-option-default docutils literal notranslate"><span class="pre">[]</span></code></p>
</div></td>
</tr>
@@ -476,7 +502,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
</div></td>
<td><div class="ansible-option-cell"><p>A list of filters. Any instances matching at least one of the filters are included in the result.</p>
<p>Available filters are listed here <a class="reference external" href="http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options">http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options</a>.</p>
-<p>Every entry in this list triggers a search query. As such, from a performance point of view, it’s better to keep the list as short as possible.</p>
+<p>Every entry in this list triggers a search query if <code class="docutils literal notranslate"><span class="pre">apply_and_logic_on_include_filters</span></code> is not set to <em>true</em>. As such, from a performance point of view, it’s better to keep the list as short as possible.</p>
<p class="ansible-option-line"><span class="ansible-option-default-bold">Default:</span> <code class="ansible-option-default docutils literal notranslate"><span class="pre">[]</span></code></p>
</div></td>
</tr>
@@ -882,6 +908,16 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">us-east-1</span>
<span class="nt">hostvars_prefix</span><span class="p">:</span><span class="w"> </span><span class="s">'aws_'</span>
<span class="nt">hostvars_suffix</span><span class="p">:</span><span class="w"> </span><span class="s">'_ec2'</span>
+
+<span class="c1"># Example using include_filters and apply_and_logic_on_include_filters to compose the inventory.</span>
+<span class="nt">plugin</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">aws_ec2</span>
+<span class="nt">regions</span><span class="p">:</span>
+<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">us-east-1</span>
+<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">us-west-1</span>
+<span class="nt">include_filters</span><span class="p">:</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">tag-key</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Role</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">tag-key</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Team</span>
+<span class="nt">apply_and_logic_on_include_filters</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
</pre></div>
</div>
<section id="authors">
|
Build failed. ❌ ansible-galaxy-importer RETRY_LIMIT in 15s |
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 10m 03s |
recheck |
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 3m 33s |
recheck |
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 4m 51s |
recheck |
Build failed. ✔️ ansible-galaxy-importer SUCCESS in 4m 03s |
recheck |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 27s |
bf073ce
to
4c14565
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 29s |
80c3ba4
to
f46afa8
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 14s |
b38acea
to
81a8707
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 37s |
) Re-enable integration tests for elb_network_lb Depends-On: ansible-collections#940 SUMMARY Re-enables integration tests for elb_network_lb Moves from hard-coded SSL certs to generating them on the fly Fixes bug where ip_address_type in return value wasn't updated ISSUE TYPE Bugfix Pull Request COMPONENT NAME tests/integration/targets/elb_network_lb ADDITIONAL INFORMATION Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None>
) Re-enable integration tests for elb_network_lb Depends-On: ansible-collections#940 SUMMARY Re-enables integration tests for elb_network_lb Moves from hard-coded SSL certs to generating them on the fly Fixes bug where ip_address_type in return value wasn't updated ISSUE TYPE Bugfix Pull Request COMPONENT NAME tests/integration/targets/elb_network_lb ADDITIONAL INFORMATION Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None>
) Re-enable integration tests for elb_network_lb Depends-On: ansible-collections#940 SUMMARY Re-enables integration tests for elb_network_lb Moves from hard-coded SSL certs to generating them on the fly Fixes bug where ip_address_type in return value wasn't updated ISSUE TYPE Bugfix Pull Request COMPONENT NAME tests/integration/targets/elb_network_lb ADDITIONAL INFORMATION Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Alina Buzachis <None>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently I forgot to submit my comment. I think this PR should be revivable...
def _build_aws_filters(filters_opts, apply_and_logic): | ||
aws_filters = [] | ||
for filter in filters_opts: | ||
aws_boto3_filter = ansible_dict_to_boto3_filter_list(filter) | ||
if apply_and_logic: | ||
aws_filters += aws_boto3_filter | ||
else: | ||
aws_filters.append(aws_boto3_filter) | ||
return [aws_filters] if apply_and_logic else aws_filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like something which should be pulled up a level with unit tests added.
SUMMARY
Closes #1354
ISSUE TYPE