diff --git a/scciclient/irmc/scci.py b/scciclient/irmc/scci.py index 58dc328..629a113 100644 --- a/scciclient/irmc/scci.py +++ b/scciclient/irmc/scci.py @@ -82,6 +82,7 @@ _POWER_CMD = ''' ''' + POWER_ON = _POWER_CMD % "PowerOnCabinet" POWER_OFF = _POWER_CMD % "PowerOffCabinet" POWER_CYCLE = _POWER_CMD % "PowerOffOnCabinet" @@ -97,10 +98,12 @@ _VIRTUAL_MEDIA_CMD = ''' ''' -MOUNT_CD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteCdImage", 0) -UNMOUNT_CD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteCdImage", 1) -MOUNT_FD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteFdImage", 0) -UNMOUNT_FD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteFdImage", 1) + +MOUNT_CD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteCdImage", 1) +UNMOUNT_CD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteCdImage", 0) +MOUNT_FD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteFdImage", 1) +UNMOUNT_FD = _VIRTUAL_MEDIA_CMD % ("ConnectRemoteFdImage", 0) + _VIRTUAL_MEDIA_CD_SETTINGS = ''' @@ -113,15 +116,15 @@ _VIRTUAL_MEDIA_CD_SETTINGS = ''' - 1 + 2 - "%s" + %s - "%s" + %s @@ -130,15 +133,15 @@ _VIRTUAL_MEDIA_CD_SETTINGS = ''' - "%s" + %s - "%s" + %s - "%s" + %s @@ -146,6 +149,8 @@ _VIRTUAL_MEDIA_CD_SETTINGS = ''' ''' + + _VIRTUAL_MEDIA_FD_SETTINGS = ''' @@ -157,32 +162,32 @@ _VIRTUAL_MEDIA_FD_SETTINGS = ''' - 1 + 2 - "%s" + %s - "%s" + %s - "%d" + %d - "%s" + %s - "%s" + %s - "%s" + %s @@ -215,7 +220,6 @@ def scci_cmd(host, userid, password, cmd, are invalid :raises: SCCIClientError if SCCI failed """ - auth_obj = None try: protocol = {80: 'http', 443: 'https'}[port] @@ -231,10 +235,12 @@ def scci_cmd(host, userid, password, cmd, {'port': port, 'auth_method': auth_method}) try: + header = {'Content-type': 'application/x-www-form-urlencoded'} r = requests.post(protocol + '://' + host + '/config', data=cmd, + headers=header, verify=False, - timeout=(10, client_timeout), + timeout=client_timeout, allow_redirects=False, auth=auth_obj) diff --git a/scciclient/tests/irmc/test_scci.py b/scciclient/tests/irmc/test_scci.py index 278a36a..2aa25c9 100644 --- a/scciclient/tests/irmc/test_scci.py +++ b/scciclient/tests/irmc/test_scci.py @@ -145,8 +145,9 @@ class SCCITestCase(testtools.TestCase): mock_requests.post.assert_called_with( 'https://' + self.irmc_address + '/config', data=scci.POWER_ON, + headers={'Content-type': 'application/x-www-form-urlencoded'}, verify=False, - timeout=(10, self.irmc_client_timeout), + timeout=self.irmc_client_timeout, allow_redirects=False, auth=mock_requests.auth.HTTPBasicAuth(self.irmc_username, self.irmc_password))