Skip to content

File placeholder not working with Delete Trigger #48

@lu-kno

Description

@lu-kno

Hi, i am using this FileWatcher to aggregate files from different folders into a single one using symlinks. On file creation, the symlink gets created with the same name in another directory.
On file deletion, it tries to delete the parent directory since [file] gets replaced with an empty string.
I've tried with both actions and commands. Same thing happens.
I've tried with [oldfile], but that doesn't seem to get replaced at all.

Configuration:


<watches>
    <logging>
        <path>/config/fw.log</path>
        <size>5</size>
        <number>10</number>
        <level>DEBUG</level>
    </logging>
    <watch>
        <path>/data/collections/collection-root</path>
        <workflows>
            <workflow>
                <triggers>
                    <trigger>Create</trigger>
                </triggers>
                <steps>
                  <step>
                    <id>create-dummy-path</id>
                    <command>
                        <path>/bin/mkdir</path>
                        <arguments>"/data/collections/collection-aggregated/[path]" -p</arguments>
                    </command>
                  </step>
                  <step>
                    <id>create-soft-link</id>
                    <command>
                        <path>/bin/ln</path>
                        <arguments>-s "[exactpath]" "/data/collections/collection-aggregated/[path]/../shared/[file]"</arguments>
                    </command>
                  </step>
                </steps>
            </workflow>
            <workflow>
                <triggers>
                    <trigger>Delete</trigger>
                </triggers>
                <steps>
                  <step>
                    <id>delete-soft-link</id>
                    <action>
                        <type>Delete</type>
                        <source>"/data/collections/collection-aggregated/[path]/../shared/[file]"</source>
                        <verify>true</verify>
                    </action>
                  </step>
                </steps>
            </workflow>
        </workflows>
    </watch>
</watches>

Logs:

2025-02-24 14:50:26.652 INFO  Log level: DEBUG.
2025-02-24 14:50:26.685 INFO  /data/collections/collection-root: Creating watch. Path: /data/collections/collection-root.
2025-02-24 14:50:26.717 INFO  /data/collections/collection-root: Watch created.
2025-02-24 14:50:26.722 DEBUG /data/collections/collection-root: Number of needs: . (Watch.Start)
2025-02-24 14:50:35.892 DEBUG /data/collections/collection-root: CanRun: True, IsRunning: False. (Watch.ProcessChange)
2025-02-24 14:50:35.893 DEBUG /data/collections/collection-root: Needs: False, Needs completed: . (Watch.ProcessChange)
2025-02-24 14:50:35.894 DEBUG /data/collections/collection-root: Starting tasks for watch. Path /data/collections/collection-root. (HasNeedsBase.OnStarted)
2025-02-24 14:50:35.895 DEBUG /data/collections/collection-root: Path: /data/collections/collection-root Queue Count: 1, Queue IsEmpty: False. (Watch.ProcessChange)
2025-02-24 14:50:35.897 DEBUG /data/collections/collection-root: Started: /data/collections/collection-root/lu/44f7681d-9007-d8dd-f931-99cb9a5e7785/2c754e6f-2685-4462-b953-a9d80283b5e8.ics, Delete (Watch.ProcessChange)
2025-02-24 14:50:35.906 INFO  Workflows variable count: 0.
2025-02-24 14:50:35.927 DEBUG Running steps. (Workflow.Run)
2025-02-24 14:50:35.931 INFO  Steps started.
2025-02-24 14:50:35.931 DEBUG Starting to run 1 step(s). (Steps.Run)
2025-02-24 14:50:35.931 DEBUG delete-soft-link: CanRun: True, Running: False, Trigger: Step (Step.Run)
2025-02-24 14:50:35.932 DEBUG delete-soft-link: Step started. (HasNeedsBase.OnStarted)
2025-02-24 14:50:35.932 DEBUG delete-soft-link: Running the action (if any). (Step.Run)
2025-02-24 14:50:35.933 DEBUG Waiting for 0 milliseconds. (Action.Run)
2025-02-24 14:50:35.994 INFO  Deleted "/data/collections/collection-aggregated/lu/44f7681d-9007-d8dd-f931-99cb9a5e7785/../shared/".
2025-02-24 14:50:35.995 DEBUG delete-soft-link: Running the command (if any). (Step.Run)
2025-02-24 14:50:35.995 DEBUG delete-soft-link: Sending the notification (if any). (Step.Run)
2025-02-24 14:50:35.995 DEBUG delete-soft-link: Step completed. (HasNeedsBase.OnCompleted)
2025-02-24 14:50:35.996 INFO  delete-soft-link: Step completed.
2025-02-24 14:50:35.997 INFO  All steps have completed.
2025-02-24 14:50:35.998 DEBUG /data/collections/collection-root: Completed: /data/collections/collection-root/lu/44f7681d-9007-d8dd-f931-99cb9a5e7785/2c754e6f-2685-4462-b953-a9d80283b5e8.ics, Delete (Watch.ProcessChange)
2025-02-24 14:50:35.998 DEBUG /data/collections/collection-root: Tasks completed for watch. (HasNeedsBase.OnCompleted)
2025-02-24 14:51:29.831 DEBUG /data/collections/collection-root: CanRun: True, IsRunning: False. (Watch.ProcessChange)
2025-02-24 14:51:29.831 DEBUG /data/collections/collection-root: Needs: False, Needs completed: . (Watch.ProcessChange)
2025-02-24 14:51:29.831 DEBUG /data/collections/collection-root: Starting tasks for watch. Path /data/collections/collection-root. (HasNeedsBase.OnStarted)

Version: 2.0.0+b92528d141fd511d3a9a2f5b9c296eb02ccd0f10
OS: Ubuntu container, on Nixos host
Extra details: Ubuntu container needed libicu-dev to be installed to run the program

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions