def main()

in assets/scripts/SilentInstaller.py [0:0]


def main():
    try:
        options = get_options()
        secrets = get_secrets(options)
        if options.type == 'updateTopology':
            package_path = os.path.join(options.installDir, "packages")
            lst = os.listdir(package_path)
            lst.sort(reverse=True)
            for subdir in lst:
                if "bin." in subdir:
                    tsm_path = os.path.join(package_path, subdir, "tsm.cmd")
                    found_tsm = False
                    if os.path.isfile(tsm_path):
                        get_nodes_and_apply_topology(options.configFile, tsm_path, secrets, options.controllerPort, apply_and_restart=True)
                        found_tsm = True
                        break
                    if not found_tsm:
                        raise OptionsError('Could not find tsm under directory %s. Please provide correct value in the installDir option' % options.installDir)
        else:
            assert_no_existing_installation()
            if options.type == 'installWorker':
                # install worker node
                run_worker_installer(options, secrets)
            else:
                # install and set up first node
                package_version = run_inno_installer(options)
                run_setup(options, secrets, package_version)
        return 0

    # by default exceptions exit with 1
    except ExistingInstallationError as ex:
        print_error(str(ex))
        return 2
    except OptionsError as ex:
        print_error(str(ex))
        return 3
    except ExitCodeError as ex:
        return 4