Skip to content

Commit

Permalink
Add capability to use ssl when connecting to winrm
Browse files Browse the repository at this point in the history
Use defaults of http/5985 for winrm

Change kwargs to start with 'winrm'

Add winrm_validate_ssl_cert kwarg
  • Loading branch information
bsquizz committed Jun 6, 2018
1 parent 97c6895 commit 94a5c0f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wrapanapi/scvmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,18 @@ class SCVMMSystem(WrapanapiAPIBaseVM):
def __init__(self, **kwargs):
super(SCVMMSystem, self).__init__(kwargs)
self.host = kwargs["hostname"]
self.port = kwargs.get("winrm_port", 5985)
self.scheme = kwargs.get("winrm_scheme", "http")
self.winrm_validate_ssl_cert = kwargs.get("winrm_validate_ssl_cert", False)
self.user = kwargs["username"]
self.password = kwargs["password"]
self.domain = kwargs["domain"]
self.provisioning = kwargs["provisioning"]
self.api = winrm.Session(self.host, auth=(self.user, self.password))
self.api = winrm.Session(
'{scheme}://{host}:{port}'.format(scheme=self.scheme, host=self.host, port=self.port),
auth=(self.user, self.password),
server_cert_validation='validate' if self.winrm_validate_ssl_cert else 'ignore',
)

@property
def pre_script(self):
Expand Down

0 comments on commit 94a5c0f

Please sign in to comment.