Using Dynamic Download to test file existance before download

(imported topic written by ktwatts91)

In 7.2 and beyond, is it possible to use the dynamic download capability to conditionally download a file depending on its location? Once it is downloaded, the normal caching process is fine.

Rough Example: A file used by a fixlet will be located in a beta share during testing and a release share after testing concludes. I’d like to write one action statement that covers both potential locations so that the fixlet will not have to change after testing to accomodate the expected change in file location.

In general, I’d like to do the following:

If (file exist “\betashare\installer.exe”)

Download “\betashare\installer.exe” *This would work properly during beta testing*\

Else

Download “\releaseshare\installer.exe” *This would work properly after beta testing completes*\

Thanks.

(imported comment written by BenKus)

Hi ktwatts,

This is not really how dynamic downloads works… In your example, you are checking for the existence of a file on a share (which is different than downloading) and then I would guess you would just copy the file… But the issue with this approach is that you would need to access to the file share by the SYSTEM account, which would mean that you would either need a null-session share or supply a username/password to the agent (which would be insecure).

Ben

(imported comment written by ktwatts91)

So is this simply impossible in the current infrastructure of BigFix?

I’d like to be definitive before I go looking for alternative solutions.

(imported comment written by BenKus)

I probably can’t answer that definitively unless I knew more about what you were trying to accomplish…

You certainly can play with permissions and get something like this to work, but the syntax you provided definitely won’t work…

Ben

(imported comment written by ktwatts91)

I’m trying to accomplish the following. Depending on the release state of a product (beta or standard), the files associated with that product will be housed in one location or another (\betashare\ or \releaseshare). I’d like to create a single fixlet that will download a file from the correct location regardless of release state.

If the product is in beta test, the fixlet will download the file from the \betashare.

If the product is out of beta (released), the fixlet will download the file from the \releaseshare.

Since beta always precedes release, the reasonable check would be to look for the file in the \betashare first.

If not found there, then the file will necessarily be located in \releaseshare, so download from there.

Thus, in basic relevance (I know the syntax isn’t correct):

If (file exist “\betashare\installer.exe”)

Download “\betashare\installer.exe”

Else

Download “\releaseshare\installer.exe”

Can this be done? If so, how?

(imported comment written by BenKus)

If you want to check the existence of a file as part of your action, you will need to open the file/share permissions for your agent to access the files… if will look like this:

If {exist file “\betashare\installer.exe”}
copy “\betashare\installer.exe” __Download\installer.exe
Elseif {exist file “\releaseshare\installer.exe”}
copy “\betashare\installer.exe” __Download\installer.exe
Endif
wait __Download\installer.exe

The trick is that you need to open your share to access not to a user but instead to the computers’ SYSTEM accounts. You can do this in AD by granting access to the Computer object (I think), or by setting up a null session share (http://support.bigfix.com/bes/misc/null_session_share.html).

Ben