Skip to content

Commit

Permalink
Refactored issue #17 and fixed issue #18
Browse files Browse the repository at this point in the history
  • Loading branch information
malavolti committed Nov 28, 2019
1 parent 7e240f2 commit 7d141f6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion roles/idp/tasks/idp-statistics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- ansible_distribution_release == "stretch"

- name: "Check if 'statistics' DB is already created and store the result into 'statistics_db' ansible variable"
command: mysql -h {{ idp_config['shibboleth_db_host'] }} -u statistics -p{{ idp_stats['db_pw'] }} -s -N -e "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='statistics'"
command: mysql -h {{ idp_stats['db_host'] }} -u statistics -p{{ idp_stats['db_pw'] }} -s -N -e "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='statistics'"
register: statistics_db
changed_when: false

Expand Down
2 changes: 1 addition & 1 deletion roles/idp/templates/statistics/dbanalysis.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def parseFiles(files):
else:
dictAll[curdate][rp][user] = 1

database = MySQLdb.connect(host="localhost", user="statistics", passwd="{{ idp_stats['db_pw'] }}", db="statistics")
database = MySQLdb.connect(host="{{ idp_stats['db_host'] }}", user="statistics", passwd="{{ idp_stats['db_pw'] }}", db="statistics")

cursor = database.cursor()
cursor.execute("SELECT MAX(data) FROM logins")
Expand Down
2 changes: 1 addition & 1 deletion roles/idp/templates/statistics/insertSP.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include "SProvider.conf.php";
include "SProvider.metadata.php";

$db = mysqli_connect("localhost", "statistics", "{{ idp_stats['db_pw'] }}", "statistics");
$db = mysqli_connect("{{ idp_stats['db_host'] }}", "statistics", "{{ idp_stats['db_pw'] }}", "statistics");

if (!$db){
die("Unable to connect to database 'statistics'");
Expand Down
2 changes: 1 addition & 1 deletion roles/idp/templates/statistics/statistics-idp-db.sql.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SET CHARACTER SET utf8;

CREATE DATABASE IF NOT EXISTS statistics CHARACTER SET=utf8;

GRANT ALL PRIVILEGES ON statistics.* TO statistics@localhost IDENTIFIED BY '{{ idp_stats['db_pw'] }}';
GRANT ALL PRIVILEGES ON statistics.* TO statistics@{{ idp_stats['db_host'] }} IDENTIFIED BY '{{ idp_stats['db_pw'] }}';

FLUSH PRIVILEGES;

Expand Down

0 comments on commit 7d141f6

Please sign in to comment.