Paul
Paul

Reputation: 577

Python Psphere Issue

Looking at using psphere. I've successfully installed it via pip but run into an issue when I execute the following code (taken from the psphere documentation site):

from psphere.client import Client
from psphere.managedobjects import HostSystem


Client = Client("server", "username", "password")

hs_list = HostSystem.all(Client)
len(hs_list)

After running that command I get the following:

"could not found expected ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "C:\Users\thor/.psphere/config.yaml", line 5, column 1

could not found expected ':' in "C:\Users\thor/.psphere/config.yaml", line 6, column 1

  1. There was no .psphere directory or config.yaml. I created both and no joy (although I must be honest - I don't really know what should be in the yaml file.)
  2. There are no : in my file so I don't know why it's raising an exception.

Help would be appreciated. Thanks.

Upvotes: 0

Views: 940

Answers (1)

Samuel Devlin
Samuel Devlin

Reputation: 159

in the distribution's examples/ directory there is a sample_config.yaml file you can use.

# Copy this file into ~/.psphree/config.yaml and edit to your liking
general:
    server: your.esxserver.com
    username: Administrator
    password: strongpassword
    template_dir: ~/.psphere/templates/
logging:
    destination: ~/.psphere/psphere.log
    level: INFO # DEBUG, INFO, etc

Upvotes: 1

Related Questions