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

"log filter" seems broken #56

Open
mashwino opened this issue Jun 1, 2020 · 3 comments
Open

"log filter" seems broken #56

mashwino opened this issue Jun 1, 2020 · 3 comments
Assignees

Comments

@mashwino
Copy link

mashwino commented Jun 1, 2020

Hi,
the functionality "log filter" seems not to work when using it with rancher nodes.

How to reproduce:

  • 01: simple task "echo RUNDECK:DATA:VARIABLE = 1".
  • 02: simple task "echo VAR = ${data.VARIABLE}"
  • Add a "log filter", global or local same behaviour", "type: Key value data", "pattern: ^RUNDECK:DATA:(.+?)\s*=\s*(.+)$", check "Log data" to display the result.
    job

=> Node: Execute locally: The VARIABLE is detected and the value is assigned
execute_local

=> Node: Dispatch to nodes: The VARIABLE is not detected
execute_node

Thank you for your work.
Regards,

@kdebisschop
Copy link
Owner

Sorry I missed this issue in my email earlier -- looking.

@kdebisschop
Copy link
Owner

I cannot reproduce the problem you are seeing. My job looks like this:

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description>Test Variables</description>
    <dispatch>
      <excludePrecedence>true</excludePrecedence>
      <keepgoing>false</keepgoing>
      <rankOrder>ascending</rankOrder>
      <successOnEmptyNodeFilter>false</successOnEmptyNodeFilter>
      <threadcount>1</threadcount>
    </dispatch>
    <executionEnabled>true</executionEnabled>
    <id>5d7eb4fc-77f2-49b7-b559-fac95127e3ef</id>
    <loglevel>INFO</loglevel>
    <name>Test Log Filter</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <nodefilters>
      <filter>site:earth group:dev service:bioraft4</filter>
    </nodefilters>
    <nodesSelectedByDefault>true</nodesSelectedByDefault>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>printf """RUNDECK:DATA:VARIABLE=11"""</exec>
        <plugins>
          <LogFilter type='key-value-data-multilines'>
            <config>
              <hideOutput>false</hideOutput>
              <logData>true</logData>
              <regex>^RUNDECK:DATA:(.+?)\s*=\s*(.+)</regex>
            </config>
          </LogFilter>
        </plugins>
      </command>
      <command>
        <exec>echo VAR = ${data.VARIABLE}</exec>
      </command>
    </sequence>
    <uuid>5d7eb4fc-77f2-49b7-b559-fac95127e3ef</uuid>
  </job>
</joblist>

Output attached:

Screen Shot 2020-10-17 at 16 30 37

@kdebisschop
Copy link
Owner

kdebisschop commented Oct 17, 2020

What I do find is that to get the data in the first place, I need to use the multi-line capture or I need to change the simple capture regular expression from:

^RUNDECK:DATA:\s*([^\s]+?)\s*=\s*(.+)$

to:

^RUNDECK:DATA:\s*([^\s]+?)\s*=\s*(.+?)\n*

This seems to be peculiar to the rancher node plugin. If I use a local command on the rundeck server, the standard regular expression works fine.

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

No branches or pull requests

2 participants