How to use configure_volume_mounts method in localstack

Best Python code snippet using localstack_python

bootstrap.py

Source:bootstrap.py Github

copy

Full Screen

...463 container.env_vars["HOST_TMP_FOLDER"] = config.dirs.functions # TODO: rename env var464 # TODO this is default now, remove once a considerate time is passed465 # to activate proper signal handling466 container.env_vars["SET_TERM_HANDLER"] = "1"467 configure_volume_mounts(container)468 # mount docker socket469 container.volumes.append((config.DOCKER_SOCK, config.DOCKER_SOCK))470 container.additional_flags.append("--privileged")471def configure_volume_mounts(container: LocalstackContainer):472 if not config.LEGACY_DIRECTORIES:473 container.volumes.add(VolumeBind(config.VOLUME_DIR, DEFAULT_VOLUME_DIR))474 return475 source_dirs = config.dirs476 target_dirs = Directories.legacy_for_container()477 # default shared directories478 for name in Directories.default_bind_mounts:479 src = getattr(source_dirs, name, None)480 target = getattr(target_dirs, name, None)481 if src and target:482 container.volumes.add(VolumeBind(src, target))483 # shared tmp folder484 container.volumes.add(VolumeBind(source_dirs.tmp, target_dirs.tmp))485 # data_dir mounting and environment variables...

Full Screen

Full Screen

abstract_deploy.py

Source:abstract_deploy.py Github

copy

Full Screen

...28 self.volume_mounts = None29 self.volumes = None30 def deploy(self):31 # Configure volume mounts32 volume_mounts = self.configure_volume_mounts()33 # Configure ports34 ports = self.configure_ports()35 # Configure environment variables36 envs = self.configure_envs()37 # Configure a container38 container = self.configure_container(volume_mounts=volume_mounts,39 ports=ports,40 envs=envs)41 # Configure volumes42 volumes = self.configure_volumes()43 # Get an api_client for cluster's config, then use that to build the api44 api_client = config.new_client_from_config(context=self.cluster_name)45 # Job flag actually just creates a pod right now, not an actual job.46 # Will switch back to actually using jobs once k8s 1.8>= is supported and backoffLimit can be used.47 if self.job:48 # Configure pod49 pod = self.configure_pod(containers=[container], volumes=volumes)50 # Configure API51 self.api = client.CoreV1Api(api_client=api_client)52 # Execute deploy53 self.api.create_namespaced_pod(namespace=self.namespace, body=pod)54 else:55 # Build up: container --> pod spec --> pod template spec56 pod_template_spec = self.configure_pod_template_spec(containers=[container],57 volumes=volumes)58 # Configure deploy spec59 deploy_spec = self.configure_deploy_spec(pod_template_spec)60 # Configure deploy object61 deploy_obj = self.configure_deploy_obj(deploy_spec)62 # Configure API63 self.api = client.ExtensionsV1beta1Api(api_client=api_client)64 # Execute deploy65 self.api.create_namespaced_deployment(namespace=self.namespace, body=deploy_obj)66 self.on_deploy_success()67 def configure_volume_mounts(self):68 if self.volume_mounts:69 return [client.V1VolumeMount(**m) for m in self.volume_mounts]70 return None71 def configure_ports(self):72 if self.ports:73 return [client.V1ContainerPort(container_port=p) for p in self.ports]74 return None75 def configure_envs(self):76 if self.envs:77 return [client.V1EnvVar(name=n, value=v) for n, v in self.envs.iteritems()]78 return None79 def configure_container(self, volume_mounts=None, ports=None, envs=None):80 return client.V1Container(81 name=self.container_name,...

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