I am building s simple python script to check a canary service is up and validate a bamboo build # . I have all the script logic complete except for one condition. The script will be used in multiple projects. Some require a canary credential ( auth ) while others do not. I can get one or the other working but not account for both. Is there anyway to ignore a deploy variable ( using a python script ) ?
canary_username = sys.argv[1]
canary_password = sys.argv[2]
canary_host = sys.argv[3]
bamboo_deploy_version = os.environ["bamboo_deploy_version"]
bamboo_build_number = os.environ["bamboo_buildNumber"]
s = requests.Session()
s.auth = () #ONLY works WITHOUT credentials
s.auth = (canary_username, canary_password) #DOES NOT WORK WITHOUT credentials
# TODO: ensure all canary services require authentication
if canary_username == "null":
s.auth = ()