Page MenuHomeDevCentral

Allow to filter a list by role
ClosedPublic

Authored by dereckson on Nov 23 2017, 04:42.
Tags
Referenced Files
F47727736: D1257.diff
Wed, Sep 2, 00:02
F47666578: D1257.id3234.diff
Tue, Sep 1, 11:42
Unknown Object (File)
Sun, Aug 30, 06:47
Unknown Object (File)
Fri, Aug 28, 08:37
Unknown Object (File)
Fri, Aug 21, 23:27
Unknown Object (File)
Thu, Aug 20, 10:58
Unknown Object (File)
Tue, Aug 18, 01:09
Unknown Object (File)
Mon, Aug 17, 20:41
Subscribers
None

Details

Summary

Currently, content to deploy to /var/wwwroot are split
in mastodon, shellserver and webserver-legacy roles.

Plan is to consolidate all of them in the webserver-content
role, and from webserver-content/init.sls, to include the relevant
states files according the target role.

To use node.has_role with if condition isn't pretty, especially as
a sls file can't only have one unique include entry.

Instead, this change provides a node.filter_by_role method, to be
able to create a pillar like this:

web_content_sls:
  mastodon:
    - .org/nasqueron/social
  shellserver:
    - .com/paysannerebelle
    - .org/eglide
  webserver-legacy:
    - .be/dereckson
    - .org/nasqueron/docs

Then, node.filter_by_role('web_content_sls') called on a node
with the mastodon role will return this list:

- .org/nasqueron/social

Ref T1325

Test Plan

Unit tests have been provided for the new method.

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
Unit
No Test Coverage
Branch
webserver-content
Build Status
Buildable 1999
Build 2247: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Nov 23 2017, 04:43
This revision was automatically updated to reflect the committed changes.