Skip to content

Commit

Permalink
No delete token (#4)
Browse files Browse the repository at this point in the history
* no more delete token needed since Orka 2.1.0

* Print line number

* Remove python 3.6 and add 3.10

* Remove python 3.6 and add 3.10

* Add python add 3.11
  • Loading branch information
rbihore committed Jun 7, 2023
1 parent 1612f9d commit d14325a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[MESSAGES CONTROL]
disable = bad-continuation, line-too-long, missing-docstring, missing-final-newline, multiple-imports, too-many-arguments, too-many-locals, wrong-import-order
disable = line-too-long, missing-docstring, missing-final-newline, multiple-imports, too-many-arguments, too-many-locals, wrong-import-order
good-names=vm
4 changes: 2 additions & 2 deletions audit_vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def main(argv):
print(vm["virtual_machine_name"].ljust(22), ':', vm['vm_deployment_status'].ljust(14), " | owner : ", vm['owner'])
continue
print(vm["virtual_machine_name"].ljust(22), ':', vm['vm_deployment_status'].ljust(14), " | owner : ", vm['status'][0]['owner'])
for status in vm['status']:
print(f'\t{status["virtual_machine_id"]}{status["node_location"]}{status["virtual_machine_ip"]} │ cpu={status["cpu"]}/{status["vcpu"]}{status["RAM"]}{status["vm_status"]}{status["creation_timestamp"]}{status["base_image"]}')
for cpt, status in enumerate (vm['status']):
print(f'\t {cpt+1} | {status["virtual_machine_id"]}{status["node_location"]}{status["virtual_machine_ip"]} │ cpu={status["cpu"]}/{status["vcpu"]}{status["RAM"]}{status["vm_status"]}{status["creation_timestamp"]}{status["base_image"]}')
vm_creation_date = datetime.strptime(status['creation_timestamp'], '%Y-%m-%dT%H:%M:%SZ')
vm_uptime_in_days = (present - vm_creation_date).days
vm_uptime_in_hours = math.floor((present - vm_creation_date).seconds / 3600)
Expand Down
13 changes: 12 additions & 1 deletion commons.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ def orka_session(orka_controller, user_email, password, license_key, retries=3,
'email': user_email,
'password': password,
}))
# print('Token 1 : ' + resp.json()['token'])
# session.headers.update({
# 'User-Agent': "UA test token",
# })
# resp = check_http_status(session.post('/token', data={
# 'email': user_email,
# 'password': password,
# }))
# print('Token 2 : ' + resp.json()['token'])
session.headers.update({
'Authorization': 'Bearer ' + resp.json()['token'],
'orka-licensekey': license_key,
'User-Agent': USER_AGENT,
})
# resp = check_http_status(session.get('/token'))
# print('Token Get : ' + resp.text)
yield session
check_http_status(session.delete('/token'))
#check_http_status(session.delete('/token'))


def check_http_status(response):
Expand Down

0 comments on commit d14325a

Please sign in to comment.