Skip to content

Commit

Permalink
remove dead code from appliance.py. rockstor#1014
Browse files Browse the repository at this point in the history
  • Loading branch information
Mchakravartula committed Nov 20, 2015
1 parent 408f65a commit 1878389
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions src/rockstor/storageadmin/views/appliances.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,7 @@ def _get_remote_appliance(self, request, ip, port, client_id,
'all inputs and try again.')
handle_exception(Exception(e_msg), request)

def _connect_to_appliance(self, request, url, ip, username, password):
try:
r = requests.post(
url,
headers={'content-type': 'application/json'},
verify=False,
data=json.dumps({'username': username,
'password': password}),
timeout=30.0)
if (r.status_code == 401):
#login incorrect
logger.error(r.text)
e_msg = ('Authentication to the remote Rockstor '
'appliance(%s) failed due to wrong id or '
'secret. Try again.' % ip)
handle_exception(Exception(e_msg), request)
if (r.status_code != 200):
logger.error(r.text)
e_msg = ('Could not establish connection with the remote '
'Rockstor appliance(%s)')
handle_exception(e_msg, request)
except requests.exceptions.ConnectionError, e:
logger.exception(e)
e_msg = ('Could not reach the remote Rockstor appliance(%s). '
'Verify the IP or hostname provided and try again' % ip)
handle_exception(Exception(e_msg), request)
except requests.exceptions.Timeout, e:
logger.exception(e)
e_msg = ('Timeout occured while connecting to the remote '
'Rockstor appliance(%s). Try again later.' % ip)
handle_exception(Exception(e_msg), request)


@transaction.atomic
def post(self, request, *args, **kwargs):
with self._handle_exception(request):
Expand Down

0 comments on commit 1878389

Please sign in to comment.