Beispiel #1
0
def testAuth():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"

    connection = proxmox.Connector(PROXMOX_HOST, PROXMOX_PORT)
    assert connection.fetch_auth_token(USER, PASSWD)
Beispiel #2
0
def testUndefinedMethod():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"

    connection = proxmox.Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = proxmox.Node(connection, PROXMOX_HOST)
    logging.debug('node is %s' % node)

    version = node.version(
    )  # UNDEFINED METHOD .version() dynamically generated
    logging.debug(version)

    assert isinstance(version, dict)
Beispiel #3
0
#!/usr/bin/env python
#######################################
#
# Example: Check cluster logs
#
#######################################

import re
import os
import sys
import time

libpath = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(libpath)

import proxmox

# connect to one of the proxmox nodes and get authenticated
c = proxmox.Connector('proxmox-7')
c.get_auth_token('root@pam', 'strawberries')

# connect into the cluster to perform actions
p = proxmox.Proxmox(c)

# print cluster logs
for line in p.cluster.log(max=5):
    print "{node}: {user} - {msg}".format(**line)