Announcement

Collapse
No announcement yet.

TrueUpdate Server: dynamic Folder Address field issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TrueUpdate Server: dynamic Folder Address field issue

    I am trying to change the Folder Address of a FTP type connection in the client script at run time. It works fine the 1st time I set it but it has no effect when set the 2nd time. I need this since the public FTP isn't accessible from the internal corp. network. The variable %FTPUrl% has been added in the Custom Session variable with a value of "value". I also inserted it in the Folder address field of the TrueUpdate server dialog. I can see that the %FTPUrl% is set properly the 1st time it enters the for loop but the 2nd time the GetServerFile tries to connect still on the 1st address even if the value of %FTPUrl% has been correctly set.

    Here is my code:
    -- Set the FTP server list
    g_ServerFolders = {};
    g_ServerFolders[1]="ftp.domain.ca/TrueUpdate/Product1/"; -- Public FTP
    g_ServerFolders[2]="ftp://172.31.100.50/TrueUpdate/Product1/"; -- Internal FTP

    for index, ServerFolder in g_ServerFolders do
    SessionVar.Set("%FTPUrl%", ServerFolder);
    Dialog.Message("Debug", SessionVar.Expand("%FTPUrl%"), MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    GotServerFiles = TrueUpdate.GetServerFile("TrueUpdateFTP", false, nil);
    -- If the download was successful, run the server script
    if (GotServerFiles) then
    -- Save package location for server script
    INIFile.SetValue(SessionVar.Expand("%SourceFolder% \\TrueUpdate.ini"), "PackageInfo", "URL", SessionVar.Expand("%FTPUrl%"));
    -- Run server script
    TrueUpdate.RunScript("Server Script");
    break;
    end
    end

    Is there a way to refresh the %FTPUrl% that the TrueUpdate.GetServerFiles is using?

  • #2
    I believe that you need to create two TrueUpdate server entries in this case. First test the local address (because a local transfer would be faster), and when this didn't work out the next one (the public FTP) would be automatically attempted if you use the default scripts, because TrueUpdate.GetUpdateServerList() would loop over all entries.

    Click image for larger version

Name:	SCRN-2015-01-09-01.png
Views:	1
Size:	25.4 KB
ID:	284268

    From what I saw, the Session Variable approach does not work as expected, because somehow internally the server address is changed only once. But you don't need to change the address multiple times: If there is a customer-specific local FTP server which should be the first attempt during an update check, then you only would need to set the Session Variable once, probably based on a command line argument or the contents of an INI file or registry key. When the first check fails, then fall back to the second entry, which would be the public FTP used by all customers of your product, followed by any other servers you may have defined.

    Click image for larger version

Name:	SCRN-2015-01-09-02.png
Views:	1
Size:	24.6 KB
ID:	284269

    Does this make sense?

    Ulrich

    Comment

    Working...
    X