{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/lemur/issues/1095","repository_url":"https://api.github.com/repos/Netflix/lemur","labels_url":"https://api.github.com/repos/Netflix/lemur/issues/1095/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/lemur/issues/1095/comments","events_url":"https://api.github.com/repos/Netflix/lemur/issues/1095/events","html_url":"https://github.com/Netflix/lemur/issues/1095","id":306969831,"number":1095,"title":"Certificate creation failure with cryptography plugin","user":{"login":"dmitryzykov","id":15911918,"avatar_url":"https://avatars1.githubusercontent.com/u/15911918?v=4","gravatar_id":"","url":"https://api.github.com/users/dmitryzykov","html_url":"https://github.com/dmitryzykov","followers_url":"https://api.github.com/users/dmitryzykov/followers","following_url":"https://api.github.com/users/dmitryzykov/following{/other_user}","gists_url":"https://api.github.com/users/dmitryzykov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitryzykov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitryzykov/subscriptions","organizations_url":"https://api.github.com/users/dmitryzykov/orgs","repos_url":"https://api.github.com/users/dmitryzykov/repos","events_url":"https://api.github.com/users/dmitryzykov/events{/privacy}","received_events_url":"https://api.github.com/users/dmitryzykov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-20T17:41:04Z","updated_at":"2018-03-21T20:43:12Z","closed_at":null,"author_association":"NONE","body":"I'm using the latest lemur version from master branch which is running in docker by https://github.com/Netflix/lemur-docker/\r\n\r\nI successfully created a new authority with Cryptography plugin in Web UI \r\n```\r\nIssuing new cryptography authority with options: {'name': 'test', 'common_name': 'test', 'organizational_unit': 'Example', 'description': 'test', 'sensitivity': 'medium', 'plugin': {'plugin_options': [{}], 'plugin_object': <lemur.plugins.lemur_cryptography.plugin.CryptographyIssuerPlugin object at 0x7f1ea2c8d348>, 'slug': 'cryptography-issuer', 'title': 'Cryptography', 'description': 'Enables the creation and signing of self-signed certificates'}, 'serial_number': 1, 'owner': 'test@test.com', 'creator': User(username=lemur), 'location': 'Los Gatos', 'validity_start': <Arrow [2018-03-20T17:31:13.584690+00:00]>, 'country': 'US', 'type': 'root', 'validity_end': <Arrow [2025-03-20T17:31:13.584690+00:00]>, 'organization': 'Example, Inc.', 'state': 'California', 'extensions': {'custom': [], 'basic_constraints': <BasicConstraints(ca=True, path_length=None)>, 'sub_alt_names': {'names': <SubjectAlternativeName(<GeneralNames([])>)>}}, 'first_serial': 1, 'validity_years': 7, 'signing_algorithm': 'sha256WithRSA', 'key_type': 'RSA2048'}\r\nAdding Critical Extension: basic_constraints <BasicConstraints(ca=True, path_length=None)>\r\nAdding Critical Extension: sub_alt_names {'names': <SubjectAlternativeName(<GeneralNames([])>)>}\r\n```\r\n\r\nBut when I'm trying to create a new certificate using this authority I get an internal server error:\r\n```\r\n[2018-03-20 17:36:44,504] ERROR in app: Exception on /api/1/certificates [POST]\r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2848, in one\r\n    ret = self.one_or_none()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2827, in one_or_none\r\n    \"Multiple rows were found for one_or_none()\")\r\nsqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/app.py\", line 1612, in full_dispatch_request\r\n    rv = self.dispatch_request()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/app.py\", line 1598, in dispatch_request\r\n    return self.view_functions[rule.endpoint](**req.view_args)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask_restful/__init__.py\", line 480, in wrapper\r\n    resp = resource(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/views.py\", line 84, in view\r\n    return self.dispatch_request(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask_restful/__init__.py\", line 595, in dispatch_request\r\n    resp = meth(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/lemur/auth/service.py\", line 135, in decorated_function\r\n    return f(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/lemur/common/schema.py\", line 152, in decorated_function\r\n    data, errors = input_schema.load(request_data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 580, in load\r\n    result, errors = self._do_load(data, many, partial=partial, postprocess=True)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 660, in _do_load\r\n    index_errors=self.opts.index_errors,\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 295, in deserialize\r\n    index=(index if index_errors else None)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 68, in call_and_store\r\n    value = getter_func(data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 288, in <lambda>\r\n    data\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/fields.py\", line 265, in deserialize\r\n    output = self._deserialize(value, attr, data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/fields.py\", line 465, in _deserialize\r\n    data, errors = self.schema.load(value)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 580, in load\r\n    result, errors = self._do_load(data, many, partial=partial, postprocess=True)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 685, in _do_load\r\n    original_data=data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 858, in _invoke_load_processors\r\n    data=data, many=many, original_data=original_data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 960, in _invoke_processors\r\n    data = utils.if_none(processor(data), data)\r\n  File \"/usr/local/src/lemur/lemur/schemas.py\", line 159, in get_object\r\n    return fetch_objects(RotationPolicy, data, many=many)\r\n  File \"/usr/local/src/lemur/lemur/schemas.py\", line 91, in fetch_objects\r\n    return model.query.filter(getattr(model, attr) == data[attr]).one()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2851, in one\r\n    \"Multiple rows were found for one()\")\r\nsqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one()\r\nException on /api/1/certificates [POST]\r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2848, in one\r\n    ret = self.one_or_none()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2827, in one_or_none\r\n    \"Multiple rows were found for one_or_none()\")\r\nsqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one_or_none()\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/app.py\", line 1612, in full_dispatch_request\r\n    rv = self.dispatch_request()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/app.py\", line 1598, in dispatch_request\r\n    return self.view_functions[rule.endpoint](**req.view_args)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask_restful/__init__.py\", line 480, in wrapper\r\n    resp = resource(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask/views.py\", line 84, in view\r\n    return self.dispatch_request(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/flask_restful/__init__.py\", line 595, in dispatch_request\r\n    resp = meth(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/lemur/auth/service.py\", line 135, in decorated_function\r\n    return f(*args, **kwargs)\r\n  File \"/usr/local/src/lemur/lemur/common/schema.py\", line 152, in decorated_function\r\n    data, errors = input_schema.load(request_data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 580, in load\r\n    result, errors = self._do_load(data, many, partial=partial, postprocess=True)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 660, in _do_load\r\n    index_errors=self.opts.index_errors,\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 295, in deserialize\r\n    index=(index if index_errors else None)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 68, in call_and_store\r\n    value = getter_func(data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/marshalling.py\", line 288, in <lambda>\r\n    data\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/fields.py\", line 265, in deserialize\r\n    output = self._deserialize(value, attr, data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/fields.py\", line 465, in _deserialize\r\n    data, errors = self.schema.load(value)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 580, in load\r\n    result, errors = self._do_load(data, many, partial=partial, postprocess=True)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 685, in _do_load\r\n    original_data=data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 858, in _invoke_load_processors\r\n    data=data, many=many, original_data=original_data)\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/marshmallow/schema.py\", line 960, in _invoke_processors\r\n    data = utils.if_none(processor(data), data)\r\n  File \"/usr/local/src/lemur/lemur/schemas.py\", line 159, in get_object\r\n    return fetch_objects(RotationPolicy, data, many=many)\r\n  File \"/usr/local/src/lemur/lemur/schemas.py\", line 91, in fetch_objects\r\n    return model.query.filter(getattr(model, attr) == data[attr]).one()\r\n  File \"/usr/local/src/lemur/venv/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 2851, in one\r\n    \"Multiple rows were found for one()\")\r\nsqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one()\r\n```"},"comment":{"url":"https://api.github.com/repos/Netflix/lemur/issues/comments/375088907","html_url":"https://github.com/Netflix/lemur/issues/1095#issuecomment-375088907","issue_url":"https://api.github.com/repos/Netflix/lemur/issues/1095","id":375088907,"user":{"login":"kevgliss","id":2262214,"avatar_url":"https://avatars0.githubusercontent.com/u/2262214?v=4","gravatar_id":"","url":"https://api.github.com/users/kevgliss","html_url":"https://github.com/kevgliss","followers_url":"https://api.github.com/users/kevgliss/followers","following_url":"https://api.github.com/users/kevgliss/following{/other_user}","gists_url":"https://api.github.com/users/kevgliss/gists{/gist_id}","starred_url":"https://api.github.com/users/kevgliss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevgliss/subscriptions","organizations_url":"https://api.github.com/users/kevgliss/orgs","repos_url":"https://api.github.com/users/kevgliss/repos","events_url":"https://api.github.com/users/kevgliss/events{/privacy}","received_events_url":"https://api.github.com/users/kevgliss/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T20:43:12Z","updated_at":"2018-03-21T20:43:12Z","author_association":"CONTRIBUTOR","body":"Interesting, could you give me a rough idea of the values you are POST'ing to the API?"}}
{"actor":{"display_login":"kevgliss"}}