X-Git-Url: https://gerrit.onap.org/r/gitweb?p=ccsdk%2Fdistribution.git;a=blobdiff_plain;f=ansible-server%2Fsrc%2Fmain%2Fansible-server%2FLoadAnsibleMySql.py;h=4bea8d1824e609aafcec038ea43930b71d8e41fe;hp=0a1c78a6ffcc68cbef6b7f8787cd58b80181db0a;hb=ef127a5f590c092e5020d8ecd6cf10eaa8329ddc;hpb=1bc5690a09462237d48e5ed409e985597681898f diff --git a/ansible-server/src/main/ansible-server/LoadAnsibleMySql.py b/ansible-server/src/main/ansible-server/LoadAnsibleMySql.py index 0a1c78a6..4bea8d18 100755 --- a/ansible-server/src/main/ansible-server/LoadAnsibleMySql.py +++ b/ansible-server/src/main/ansible-server/LoadAnsibleMySql.py @@ -19,7 +19,6 @@ * See the License for the specific language governing permissions and * limitations under the License. * -* ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ ''' @@ -48,7 +47,7 @@ class mySql(): self.cur.execute(myquery) self.db.commit() results = self.cur.fetchall() - except Exception, e: + except Exception as e: error = str (e) return results, error @@ -101,7 +100,7 @@ def loadCredentials (hostgroup, hostname, cred): query = "SELECT hostname,hostgroup FROM inventory WHERE hostname='" + hostname +"'" results = sqlintf.Query (query) - print '==>', results + print('==>', results) if hostname in str(results): @@ -156,24 +155,24 @@ if __name__ == '__main__': sqlintf = mySql (host, user, passwd, db) # Load playbooks - print "Loading playbooks" + print("Loading playbooks") for file in onlyfiles: if "yml" in file: name = file.split (".yml")[0] - print " Loading:", name + print(" Loading:", name) version = name.split("@")[1] errorCode, diag = loadPlaybook (name, version) if errorCode: - print " Results: Failed - ", diag + print(" Results: Failed - ", diag) else: - print " Results: Success" + print(" Results: Success") if "tar.gz" in file: name = file.split (".tar.gz")[0] - print " Loading:", name + print(" Loading:", name) version = name.split("@")[1] errorCode, diag = loadPlaybook (name, version, ".tar.gz") - print "\nLoading inventory" + print("\nLoading inventory") # Load inventory hostgroup = None @@ -193,15 +192,15 @@ if __name__ == '__main__': file.close() for hostgroup in inv: - print " Loading:", hostgroup + print(" Loading:", hostgroup) hostfqdn = '' cred = '' for hostname in inv[hostgroup]: cred = inv[hostgroup][hostname] errorCode, diag = loadCredentials (hostgroup, hostname, cred) if errorCode: - print " Results: Failed - ", diag + print(" Results: Failed - ", diag) else: - print " Results: Success" + print(" Results: Success") sqlintf.Close()