File was not marked for prefetch in download pre-pass

I dont know what I am missing here but this supposed to be working, I am trying to run an action require relevance based conditional download, even relevance is correct download is not happening & ending with error “File was not marked for prefetch in download pre-pass

I am able to overcome with direct Download command but want to understand why its not working with “prefetch”.

//check relevance -
if {(((exists folder (pathname of parent folder of regapp "BESClient.exe") whose (exists file "ABC.log" whose (exists (lines of it) whose (it as lowercase contains "1.2.3.4,80,Success" as lowercase)) of it) AND exists folder (pathname of parent folder of regapp "BESClient.exe") whose (exists file "ABC.log" whose (exists (lines of it) whose (it as lowercase contains "1.2.3.4,443,Success" as lowercase)) of it))))}

//Download
prefetch 1578b80c8daae8b0f834a62bb4278a6c1316e7d2 sha1:1578b80c8daae8b0f834a62bb4278a6c1316e7d2 size:27034740 http://ABCCorp:52311/Uploads/1578b80c8daae8b0f834a62bb4278a6c1316e7d2/mypackage.tmp sha256:e4b3b2435e2522bdad8a9b82db6114dbab853d0e802172eb1ef7296b6c03e482
extract 1578b80c8daae8b0f834a62bb4278a6c1316e7d2

elseif
another relevance & download stuff…

Have you tried running just the prefetch in the FixletDebugger? You can check the file downloaded matches the values in your prefetch command that will should find in the "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__FixletDebugger\__Local" and"C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__FixletDebugger\__Download" folders. You can also see any errors via the output and errors tabs in the debugger

1 Like

Yes @SLB, there is no issue with prefetch command, I tested it on fixlet debugger thats the very 1st thing I did, thinking of could be any issue with values but thats negative !!!

However if I am doing as below its downloading without any issue.

Download http://ABCCorp:52311/Uploads/1578b80c8daae8b0f834a62bb4278a6c1316e7d2/mypackage.tmp 
extract mypackage.tmp

Could well be its not prefetching as the "if" condition isn’t true.

2 Likes

Yes, that will be there True & False, based on True and False conditional downloading this will happen thats the whole point of putting it there.

I already gone through these links but not able to understand WHY prefetch is not working.

How about removing the if condition, just for the process of elimination, and see if the prefetch works then. If it does then it narrows the issue to the if statement, maybe its throwing singular expression error and not evaluating as boolean.

1 Like

Tried that either but no issue with direct prefetch, below is the result from fixlet debugger for that relevance, I dont see any issue with it too.

Q: (((exists folder (pathname of parent folder of regapp "BESClient.exe") whose (exists file "ABC.log" whose (exists (lines of it) whose (it as lowercase contains "1.2.3.4,80,Success" as lowercase)) of it) AND exists folder (pathname of parent folder of regapp "BESClient.exe") whose (exists file "ABC.log" whose (exists (lines of it) whose (it as lowercase contains "1.2.3.4,443,Success" as lowercase)) of it))))
A: False

T: 0.942 ms

I don’t understand the issue here.
According to the Fixlet Debugger,your relevance is False so the file should not be downloaded…if you try to reference the file later in the script you should get the error message that you see.

1 Like

is the ABC.log file created during the run of your action based on something else running?
If so, you might want to check out a pre-fetch Block to run your initial thing:

https://developer.bigfix.com/action-script/reference/download/begin-prefetch-block.html

3 Likes

That was just an example @JasonWalker to show case relevance is correct it will only give either True or False. On actual machine its True but prefetch failing with that error.

Yes Abc.log is getting created prior to run anything on the machine and part of same action script.

Prefetch block yes thats seems something promissing i will try that and update.

However the way I am running relevance based conditional download it suppose to run without any issues dont why this creating any problem here.

1 Like

‘prefetch’ statements download files before the action begins…it sounds like at that point, your ABC.LOG file won’t exist as it is created during the action execution?

If your action is changing the state of the machine (like creating the log file) and you need to download files based on that new state, ‘download’ rather than ‘prefetch’ would be necessary.

‘prefetch’ is intended to allow downloading files ahead of time, before the action starts. Like downloading patches in the background to install them later, so we don’t have to wait for downloads during the action execution.

2 Likes

Yes, @JasonWalker thats the case actually, I am able to download content with Download command not with prefetch

1 Like

I would have expected the prefetch to work then if you removed the if condition for the action. What do the client logs show when the actions run?

For cases where content is only required if a condition if true, I would favor the prefetch block method that @brolly33 mentioned as you are then able to build up a download list of only the files needed which can reduce resource overheads downloading content that isn’t used.

2 Likes

The log file on which the prefetch is based, was being created as part of the action execution- so during the prefetch time itevaluates false (log does not exist) but changes to true during execution.

3 Likes