Skip to content

Commit

Permalink
Merge pull request #157 from asmorodskyi/fix_azure
Browse files Browse the repository at this point in the history
Fix regression caused by upgrade of Azure API libs
  • Loading branch information
asmorodskyi authored Aug 5, 2022
2 parents 685a5bb + 19ccc58 commit c4c196a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY requirements.txt /pcw/
# * Install system requirements
# * Install pip requirements
# * Empty system cache to conserve some space
RUN zypper -n in python310-devel python310-pip gcc libffi-devel && pip3.10 install -r /pcw/requirements.txt && rm -rf /var/cache
RUN zypper -n in python310-devel gcc libffi-devel && pip3.10 install -r /pcw/requirements.txt && rm -rf /var/cache

# Copy program files only
COPY ocw /pcw/ocw/
Expand Down
10 changes: 2 additions & 8 deletions Dockerfile_dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ COPY requirements.txt /tmp/
# * Install system requirements
# * Install pip requirements
# * Empty system cache to conserve some space
RUN zypper -n in python310-devel python310-pip gcc libffi-devel && pip3.10 install -r /tmp/requirements.txt && rm -rf /var/cache
RUN zypper -n in python310-devel gcc libffi-devel && pip3.10 install -r /tmp/requirements.txt && rm -rf /var/cache

WORKDIR /pcw

## Finalize ################################################################# ##

VOLUME /pcw/db

EXPOSE 8000/tcp

ENTRYPOINT ["sh", "-c", "/pcw/container-startup", "$@"]
ENTRYPOINT ["sh", "-c", "/pcw/container-startup $@"]
10 changes: 9 additions & 1 deletion container-startup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/sh
# Startup helper for pcw. This file makes the handling with pcw within containers easier
# See usage() for a usage summary

Expand All @@ -14,6 +14,8 @@ function usage() {
echo " run Standart publiccloud-watcher run procedure"
echo " migrate Run database migration"
echo " createsuperuser Create superuser. Requires --email and --username argument"
echo " updaterun Do a regular instance scan and persist results to local DB"
echo " rmclusters Scan whole AWS account and delete ANY EKS clusters"
echo ""
echo "All other commands will be passed as arguments to 'manage.py'"
}
Expand Down Expand Up @@ -48,6 +50,12 @@ case "$CMD" in
"createsuperuser")
python3 manage.py createsuperuser $@
;;
"updaterun")
python3 manage.py updaterun
;;
"rmclusters")
python3 manage.py rmclusters
;;
*)
python3 manage.py $@
esac
6 changes: 3 additions & 3 deletions ocw/lib/azure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .provider import Provider, Image
from webui.settings import PCWConfig
from azure.common.credentials import ServicePrincipalCredentials
from azure.identity import ClientSecretCredential
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.storage import StorageManagementClient
Expand Down Expand Up @@ -56,8 +56,8 @@ def container_client(self, container_name):

def sp_credentials(self):
if (self.__sp_credentials is None):
self.__sp_credentials = ServicePrincipalCredentials(client_id=self.getData(
'client_id'), secret=self.getData('client_secret'), tenant=self.getData('tenant_id'))
self.__sp_credentials = ClientSecretCredential(client_id=self.getData(
'client_id'), client_secret=self.getData('client_secret'), tenant_id=self.getData('tenant_id'))
return self.__sp_credentials

def compute_mgmt_client(self):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ azure-mgmt-compute==27.2.0
azure-mgmt-storage==20.0.0
azure-mgmt-resource==21.1.0
azure-storage-blob==12.13.0
azure-identity==1.10.0
msrestazure==0.6.4
uwsgi==2.0.20
requests==2.28.1
Expand Down

0 comments on commit c4c196a

Please sign in to comment.