~james-page/ubuntu-openstack-ci/drop-tox-from-slave-config

« back to all changes in this revision

Viewing changes to run/job-parts/deprecated/build_charm_whoami_check.py

  • Committer: Ryan Beisner
  • Date: 2018-12-13 21:10:41 UTC
  • mto: This revision was merged to the branch mainline in revision 409.
  • Revision ID: ryan.beisner@canonical.com-20181213211041-5xw4jn4u17ujbv6o
Actually remove the deprecated things

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python3
2
 
"""
3
 
Check that charm store login is working
4
 
"""
5
 
import logging
6
 
import subprocess
7
 
import sys
8
 
 
9
 
DESCRIPTION = 'CHARM WHOAMI CHECK'
10
 
 
11
 
EXPECTED = [
12
 
    'openstack-charmers',
13
 
    'openstack-charmers-next'
14
 
]
15
 
 
16
 
 
17
 
def get_charm_whoami_info():
18
 
    logging.debug('Getting charm whoami output')
19
 
    output = subprocess.check_output(['charm', 'whoami']).decode('UTF-8')
20
 
    return output.strip()
21
 
 
22
 
 
23
 
def check_charm_whoami_output(output):
24
 
    logging.debug('Checking charm whoami output')
25
 
    for blob in EXPECTED:
26
 
        assert blob in output, '"{}" not in output: "{}"'.format(blob, output)
27
 
 
28
 
 
29
 
def main():
30
 
    """
31
 
    Check commands
32
 
    """
33
 
    whoami_info = get_charm_whoami_info()
34
 
    check_charm_whoami_output(whoami_info)
35
 
    logging.debug('OK')
36
 
 
37
 
 
38
 
if __name__ == '__main__':
39
 
    logging.basicConfig(level=logging.DEBUG)
40
 
    logging.info('--> {} ({})'.format(DESCRIPTION, sys.argv[0]))
41
 
    sys.exit(main())