Skip to content

Commit

Permalink
reduced Docker image file size, fixed DUO return message
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Kantas committed Jun 21, 2018
1 parent 2f22ae8 commit ba28823
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Expand Up @@ -34,8 +34,18 @@ EXPOSE 5000
# Create the pex file
RUN ./pants clean-all binary :gatekeeper

# Import python and remove base container
FROM python:2.7.14

# Set the working directory to /app
WORKDIR /app

# Copy project files
ADD . /app

# Copy pex from base build
COPY --from=base /app/dist /app/dist
COPY --from=base /app/static /app/static

# Run gatekeeper.pex when container starts
CMD ["python", "dist/gatekeeper.pex"]
15 changes: 10 additions & 5 deletions libs/duo/__init__.py
Expand Up @@ -15,10 +15,15 @@ def _create_duo_client(self):
Creates a DUO Admin API Client object.
:return: DUO client object
"""
client = duo_client.Admin(ikey=self.config["ikey"],
skey=self.config["skey"],
host=self.config["host"],
ca_certs=self.config["ca_certs"])
if self.config["ca_certs"] == "":
client = duo_client.Admin(ikey=self.config["ikey"],
skey=self.config["skey"],
host=self.config["host"])
else:
client = duo_client.Admin(ikey=self.config["ikey"],
skey=self.config["skey"],
host=self.config["host"],
ca_certs=self.config["ca_certs"])

if self.use_proxy is True:
self.proxy_headers = {"Proxy-Authorization": "Basic " + base64.b64encode(b"%s:%s" % (
Expand Down Expand Up @@ -58,7 +63,7 @@ def delete_user(self, user_id):
:return: Bool
"""
r = self.admin_api.delete_user(user_id)
if r is None:
if "response" in r and r["response"] == "":
return True
else:
return False
Expand Down
5 changes: 4 additions & 1 deletion tests/libs/duo/mock_results/delete_user_resource
@@ -1 +1,4 @@
null
{
"stat": "OK",
"response": ""
}

0 comments on commit ba28823

Please sign in to comment.