Skip to content

Commit

Permalink
DEVOPS-6 fixed python syntax isssue
Browse files Browse the repository at this point in the history
  • Loading branch information
githubofkrishnadhas committed Dec 9, 2023
1 parent f831158 commit 555e3b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/keyvault_management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ jobs:
runs-on: ubuntu-latest
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRETS }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug
run: |
echo "Secret Value: ${{ github.event.inputs.secret_value }}"
- name: set up python
uses: actions/setup-python@v2
- name: package installations
Expand Down
6 changes: 3 additions & 3 deletions kv_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def keyvault_management_operations(keyvault_name: str, operation: str, secret_na

elif operation == "delete":
print (f"Operation being performed is : Delete on {keyvault_name}")
delete_secret = client.begin_delete_secret(secret_name).result ()
client.begin_delete_secret(secret_name).result ()
print (f"deleting secret {secret_name} from {keyvault_name}")

elif operation == "list_deleted_secrets":
Expand All @@ -54,7 +54,7 @@ def keyvault_management_operations(keyvault_name: str, operation: str, secret_na
print(f"Deleted secret purge date is : {secrets.scheduled_purge_date}")
elif operation == "recover":
print(f"Operation being performed is : Recovery of secret on {keyvault_name}")
recover_secret = client.begin_recover_deleted_secret(secret_name).result()
client.begin_recover_deleted_secret(secret_name).result()
print(f"Recovered secret {secret_name}")
else:
print (f"Invalid operation. Operation should be one among get, list, set, delete, list_deleted_secrets")
Expand All @@ -72,7 +72,7 @@ def main():
parser.add_argument('--client_secret', type=str, default=os.getenv('AZURE_CLIENT_SECRET'), help= 'azure client secret for authentication')
parser.add_argument('--tenant_id', type=str, default=os.getenv('AZURE_TENANT_ID'), help= 'azure tenant id for authentication')
parser.add_argument('--keyvault_name', type= str, required=True,help='Keyvault to authenticate and modify the secrets in it')
parser.add_argument ('--operation', type= str,choices=['get', 'set', 'list', 'delete', 'list_deleted_secrets'],
parser.add_argument ('--operation', type= str,choices=['get', 'set', 'list', 'delete', 'list_deleted_secrets','recover'],
required=True, help='get / set / list / delete / list_deleted_secrets / recover actions')
parser.add_argument('--secret_name', type=str, help= 'secret name', default='')
parser.add_argument('--secret_value', type=str, help = 'secret value to be modified in keyvault',default='')
Expand Down

0 comments on commit 555e3b5

Please sign in to comment.