Lua script to sync/deploy packages to robots using ADE

File uploaded by dgill_gocloudwave.com on Sep 20, 2018Last modified by dgill_gocloudwave.com on Nov 14, 2018
Version 3Show Document
  • View in full screen mode

This Lua script will use the ADE to deploy/sync packages throughout your environment. It can be used for any package in the archive; however, the script is designed to skip hub robots. I added that logic in to ensure a hub robot doesn't restart during package deployment.

 

For example, you have two versions of cdm in the archive (6.20 and 6.30). If you want every robot in the environment that has cdm installed to be running 6.30, then you could create a schedule to run the script and use the following parameters: cdm 6.30 UPDATE ALL

 

If you wanted every robot to have version 6.30 of the cdm probe regardless of whether the cdm probe is currently installed or not, then the parameters would be: cdm 6.30 PUSH ALL

 

If you only wanted to deploy to a single hub and only if cdm is already installed, the parameters would be: cdm 6.30 UPDATE HUB_NAME

 

If you want to deploy a package one time if the same version hasn't already been installed, the parameters would be: cdm 6.30 INSTALL HUB_NAME

 

--------------------------------------------------------------------------------------------------
-- script : sync-packages.lua
-- author : Dan Gill
-- June 2017
-- version: 1.5
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
-- desc   : The intention of this script is to automate the process of updating packages.
-- This script should be run by the nas with arguments passed to it. The first argument must be the
-- package name, the second argument must be the version, and the third argument must be whether a
-- fresh install is desired (deploy regardless of whether probe currently is installed on the robot),
-- the fourth argument is the hub name ro process or ALL for all hubs.
-- This script will EXCLUDE ALL HUB ROBOTS from processing.
-- Alternatively, the script may be run manually and will use the variables provided in the script.
-- The folder "script_logs" *MUST* be manually created under the nas directory prior to running this
-- script.
---------------------------------------------------------------------------------------------------        
---------------------------------------------------------------------------------------------------
-- Version  | Details
---------------------------------------------------------------------------------------------------
-- 1.0      | Initial Version
-- 1.1      | 9/13/2018 Added parameter to specify if script should be run against a single hub or
--            ALL. Converted to used more functions for faster processing. Converted output to file.
-- 1.2      | 9/20/2018 - Replace dofile with require and added package.path update; this makes
--            passing the path to the includes files simpler. Swapped out file.write and print
--            statements with output function from logging_functions.
-- 1.3      | 10/3/2018 - Added additional error checking.
-- 1.4      | 11/13/2018 - Added hub name to output log. Also added task dump to log output to ease
--            probe callback get_task_status against the ADE.
-- 1.5      | 11/14/2018 - Added PUSH, UPDATE, and INSTALL installation types for various types of
--            package installs

Attachments

Outcomes