Looking through the code and readme, I see that we tell people to update the hard-coded value. It would be more user friendly if we used something like argparse to be able to set those values at runtime on the command line. The less editing people have to do to run this tool, the better the experience will be.
Something like:
class Password(argparse.Action):
def __call__(self, parser, namespace, values, option_string):
if values is None:
values = getpass.getpass()
setattr(namespace, self.dest, values)
parser = argparse.ArgumentParser()
parser.add_argument('--user', '-u', dest='username', help='user to authenticate to CM as', type=str)
parser.add_argument('--pass','-p', action=Password, nargs='?', dest='password', help='Enter your password')
parser.add_argument('--verify-ssl', dest='verifyssl', default=False, action='store_true', help='enable SSL verification for CM')
parser.add_argument('--host', '-h', dest='cmhostname', help='cm hostname to connect to')
args = parser.parse_args()
cm_client.configuration.username = args.username
cm_client.configuration.password = args.password
cm_client.configuration.verify_ssl = args.verifyssl
cm_host = args.cmhostname
Haven't tested the password part of this, but I think the rest is basically correct (although written from memory).
https://github.com/cloudera-labs/toolkits/blob/main/upgrade-toolkit/CDP%20Version%20Check/version_check.py
Looking through the code and readme, I see that we tell people to update the hard-coded value. It would be more user friendly if we used something like argparse to be able to set those values at runtime on the command line. The less editing people have to do to run this tool, the better the experience will be.
Something like:
Haven't tested the password part of this, but I think the rest is basically correct (although written from memory).