After upgrading from 6.3 to 6.6 - • Python Access fails
search cancel

After upgrading from 6.3 to 6.6 - • Python Access fails

book

Article ID: 116279

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio) CA Release Automation - DataManagement Server (Nolio)

Issue/Introduction

We need the API Access in order to setup and deploy all of our application. After migrating from RA 6.3, where everything works fine, to RA 6.6 we find the following show stopper, described below.

•    Java works
•    Browser works
•    Python Access fails

Can you tell us, what needs to be configured? 
 

Environment

CA Release Automation 6.3
CA Release Automation 6.6

Cause

The root cause of the reported issue was related to redirects that were being done in CARA 6.6. Without handling the redirection the session is of the redirect which doesn't work properly.

 

Resolution

The redirect was was handled by using the following:
class NoRedirectHandler(urllib2.HTTPRedirectHandler):
    # alternative handler
    def http_error_300(self,req,fp,code,msg,header_list):
        data = urllib.addinfourl(fp,header_list,req.get_full_url())
        data.status = code
        data.code = code

        return data

    # setup aliases
    http_error_301 = http_error_300
    http_error_302 = http_error_300
    http_error_303 = http_error_300
    http_error_307 = http_error_300

urllib2.install_opener(
    urllib2.build_opener(NoRedirectHandler())
)


The above was needed while handling the first urlopen to: http://localhost:8080/datamanagement/login.jsp (which we also recommended/changed to datamanagement/j_spring_security_check). It was handled by using the following after opening the connection with urlopen: if connection.code == 200 or connection.code == 302:

 

Additional Information

In the issue reported there were also two separate urlopen's being made to the same CARA URI. The first one is to the login.jsp/j_spring_security_check. The second urlopen call being made was pointed at the URI with the needed data (http://localhost:8080/datamanagement/a/api/applications) using the jsession-id to authenticate.

The script attached was recommended and doesn't make the login urlopen request. It uses one call (to the applications api) using basic authorization.
 

Attachments

1558536860770usingBasicAuthorization.py get_app