How to use check_aws_credentials method in localstack

Best Python code snippet using localstack_python

deploy.py

Source:deploy.py Github

copy

Full Screen

...203 if region() is None:204 logger.error('Region is not set up. please run aws configure')205 return False206 try:207 check_aws_credentials()208 except AttributeError:209 logger.error('AWS credentials not found. please run aws configure')210 return False211 return True212def run():213 prepare_zip()214 role_arn = role()215 for component in WIRING + config.get("extra_wiring", []):216 function_arn = create_update_lambda(role_arn, component['lambda'])217if __name__ == '__main__':218 try:219 preflight_checks()220 run()221 except Exception:...

Full Screen

Full Screen

environment.py

Source:environment.py Github

copy

Full Screen

...65 config.read(paths.pop())66CONFIG.add_section('env')67CONFIG['env'].update(os.environ)68load_configs(CONFIG, PROJECT_DIR, DIR)69def check_aws_credentials():70 ''''''71 try:72 boto3.client('sts').get_caller_identity()73 except:74 print("\n\n#####################")75 print("Currenlty selected AWS credentials are invalid!")76 print("#####################")77 exit(1)78def before_all(context):79 """Set required module variables."""80 check_aws_credentials()81 global DEBUG, DISABLE_DOCKER_UP, DISABLE_DOCKER_DOWN82 DEBUG = context.config.userdata.getbool("DEBUG")83 DISABLE_DOCKER_UP = context.config.userdata.getbool("DISABLE_DOCKER_UP")84 DISABLE_DOCKER_DOWN = context.config.userdata.getbool("DISABLE_DOCKER_DOWN")85 86 core.INIT_ENV(context, MODULES)87 core.SET_REQ_VARS(context,88 project_root=PROJECT_DIR,89 test_root=DIR)90 if not DISABLE_DOCKER_UP and not disable_docker(): 91 p = subprocess.Popen(['docker-compose', 'up', '-d', '--no-recreate'],92 cwd=DIR, env=CONFIG['env'])93 p.wait()94 time.sleep(5)...

Full Screen

Full Screen

helper.py

Source:helper.py Github

copy

Full Screen

...11 # return ip12 print "oog"13 else:14 return False15def check_aws_credentials():16 if (os.environ.get("AWS_ACCESS_KEY_ID", None) is not None and17 os.environ.get("AWS_SECRET_ACCESS_KEY") is not None):18 return True19 else:20 raise ValueError("AWS credentials are not in env variable")21def manage_aws_credentials(aws_access_key_id, aws_secret_access_key):22 """23 Make sure credential are in the OS ENV24 """25 # if user asks to change credential in our env26 if aws_access_key_id is not None:27 os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id28 if aws_secret_access_key is not None:29 os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key30 # check31 check_aws_credentials()32 # # if we don't have credentials in our env we ask for them33 # if "AWS_ACCESS_KEY_ID" not in os.environ:34 # msg_KEY_ID = "AWS_ACCESS_KEY_ID :"35 # os.environ["AWS_ACCESS_KEY_ID"] = input(msg_KEY_ID)36 # if "AWS_SECRET_ACCESS_KEY" not in os.environ:37 # msg_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY :"38 # os.environ["AWS_SECRET_ACCESS_KEY"] = input(msg_ACCESS_KEY)39DOCKER_COMPOSE_YML = \40"""version: "2"41services:42 master:43 container_name: master44 image: {image}45 command: /usr/spark/bin/spark-class org.apache.spark.deploy.master.Master --host master {args}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful