Exemple #1
0
            if commands:
                for command in commands:
                    output, error = c.run_command(command, host)
                    if error != []:
                        raise Exception(error[0])
                    else:
                        print("\n*** Output of '{}' on '{}'".format(command, host))
                    for o in output:
                        print(o.strip('\n'))
            elif install_pkgs:
                p = Packages()
                p.install_package(host, install_pkgs)
                s = Service()
                s.manageService(pkg_service_deps, 'restart', service_pkg_deps, host)
            elif uninstall_pkgs:
                p = Packages()
                p.uninstall_package(host, uninstall_pkgs)
            elif upgrade_pkgs:
                p = Packages()
                p.upgrade_package(host, upgrade_pkgs)
            elif file_data and file_metadata:
                f = File()
                f.create_file(host, file_data, file_metadata)
            elif not file_data and file_metadata:
                f = File()
                f.delete_file(host, file_metadata)
            elif services:
                s.manageService(services, service_action, service_pkg_deps, host)
    except Exception as e:
        print(e)