{"action":"created","issue":{"url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/67","repository_url":"https://api.github.com/repos/MetricsGrimoire/sortinghat","labels_url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/67/comments","events_url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/67/events","html_url":"https://github.com/MetricsGrimoire/sortinghat/issues/67","id":158967822,"number":67,"title":"Adding a duplicate identity generate wrong Exception not catched","user":{"login":"acs","id":209533,"avatar_url":"https://avatars.githubusercontent.com/u/209533?v=3","gravatar_id":"","url":"https://api.github.com/users/acs","html_url":"https://github.com/acs","followers_url":"https://api.github.com/users/acs/followers","following_url":"https://api.github.com/users/acs/following{/other_user}","gists_url":"https://api.github.com/users/acs/gists{/gist_id}","starred_url":"https://api.github.com/users/acs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acs/subscriptions","organizations_url":"https://api.github.com/users/acs/orgs","repos_url":"https://api.github.com/users/acs/repos","events_url":"https://api.github.com/users/acs/events{/privacy}","received_events_url":"https://api.github.com/users/acs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"sduenas","id":833352,"avatar_url":"https://avatars.githubusercontent.com/u/833352?v=3","gravatar_id":"","url":"https://api.github.com/users/sduenas","html_url":"https://github.com/sduenas","followers_url":"https://api.github.com/users/sduenas/followers","following_url":"https://api.github.com/users/sduenas/following{/other_user}","gists_url":"https://api.github.com/users/sduenas/gists{/gist_id}","starred_url":"https://api.github.com/users/sduenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sduenas/subscriptions","organizations_url":"https://api.github.com/users/sduenas/orgs","repos_url":"https://api.github.com/users/sduenas/repos","events_url":"https://api.github.com/users/sduenas/events{/privacy}","received_events_url":"https://api.github.com/users/sduenas/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-06-07T16:29:53Z","updated_at":"2016-06-09T12:16:56Z","closed_at":null,"body":"When adding a duplicated identity Sorting Hat normally generate an AlreadyExistsError exception. In this case, it does not.\r\n\r\n```\r\n2016-06-07 05:26:03,207 Trying to add a None identity. Ignoring it.\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py\", line 951, in _execute_context\r\n    context)\r\n  File \"/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py\", line 436, in do_execute\r\n    cursor.execute(statement, parameters)\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/cursors.py\", line 226, in execute\r\n    self.errorhandler(self, exc, value)\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/connections.py\", line 36, in defaulterrorhandler\r\n    raise errorvalue\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/cursors.py\", line 217, in execute\r\n    res = self._query(query)\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/cursors.py\", line 378, in _query\r\n    rowcount = self._do_query(q)\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/cursors.py\", line 341, in _do_query\r\n    db.query(q)\r\n  File \"/usr/local/lib/python3.4/dist-packages/MySQLdb/connections.py\", line 280, in query\r\n    _mysql.connection.query(self, query)\r\n_mysql_exceptions.IntegrityError: (1062, \"Duplicate entry 'c83c63183055df33c3cd046dd4ff31b87a09de75' for key 'PRIMARY'\")\r\n \r\nThe above exception was the direct cause of the following exception:\r\n \r\nTraceback (most recent call last):\r\n  File \"/home/bitergia/GrimoireELK/utils/grimoire/arthur.py\", line 292, in enrich_backend\r\n    ocean_backend, enrich_backend)\r\n  File \"/home/bitergia/GrimoireELK/utils/grimoire/arthur.py\", line 229, in enrich_sortinghat\r\n    new_identities, backend_name)\r\n  File \"/home/bitergia/GrimoireELK/utils/grimoire/elk/sortinghat.py\", line 61, in add_identities\r\n    identity['name'], identity['username'])\r\n  File \"/usr/local/lib/python3.4/dist-packages/sortinghat/api.py\", line 165, in add_identity\r\n    return identity_id\r\n  File \"/usr/lib/python3.4/contextlib.py\", line 66, in __exit__\r\n    next(self.gen)\r\n  File \"/usr/local/lib/python3.4/dist-packages/sortinghat/db/database.py\", line 60, in connect\r\n```"},"comment":{"url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/comments/224877433","html_url":"https://github.com/MetricsGrimoire/sortinghat/issues/67#issuecomment-224877433","issue_url":"https://api.github.com/repos/MetricsGrimoire/sortinghat/issues/67","id":224877433,"user":{"login":"sduenas","id":833352,"avatar_url":"https://avatars.githubusercontent.com/u/833352?v=3","gravatar_id":"","url":"https://api.github.com/users/sduenas","html_url":"https://github.com/sduenas","followers_url":"https://api.github.com/users/sduenas/followers","following_url":"https://api.github.com/users/sduenas/following{/other_user}","gists_url":"https://api.github.com/users/sduenas/gists{/gist_id}","starred_url":"https://api.github.com/users/sduenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sduenas/subscriptions","organizations_url":"https://api.github.com/users/sduenas/orgs","repos_url":"https://api.github.com/users/sduenas/repos","events_url":"https://api.github.com/users/sduenas/events{/privacy}","received_events_url":"https://api.github.com/users/sduenas/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T12:16:56Z","updated_at":"2016-06-09T12:16:56Z","body":"The problem was found in those identities which their values are longer than the maximum length allowed for the fields in the database (currently is set to 128). For instance, the email value of the identity to insert is this one.\r\n\r\n```\r\n 'Chris Peterson ext:(%2C%20Shih-Chiang%20Chien%20%3Cschien%40example.com%3E%20and%20Chris%20Jones%20%3Cjones.chris.g%40example.com.%3E)'\r\n```\r\nIts length is 134, 5 characters longer than the maximum allowed value. When it is inserted, the value is truncated to 128 characters. When the same identity is inserted again, the code will compare a string of 134 characters with the one inserted in the database that has 128. The comparison will say that both strings are not equal, allowing to insert the same identity twice. But because both identities have the same primary key (the same uuid) and the same truncated values, the database will raise this exception."}}
{"actor":{"display_login":"sduenas"}}