def get_deployment(self, nickname): """Returns a pod-specific deployment.""" if 'deployments' not in self.yaml: raise ValueError('No pod-specific deployments configured.') destination_configs = self.yaml['deployments'] if nickname not in destination_configs: text = 'No deployment named {}. Valid deployments: {}.' raise ValueError(text.format(nickname, ', '.join(destination_configs.keys()))) deployment_params = destination_configs[nickname] kind = deployment_params.pop('destination') try: config = destination_configs[nickname] deployment = deployments.make_deployment(kind, config, name=nickname) except TypeError: logging.exception('Invalid deployment parameters.') raise if deployment.config.keep_control_dir: deployment.pod = self return deployment
def get_deployment(self, nickname): """Returns a pod-specific deployment.""" if "deployments" not in self.yaml: raise ValueError("No pod-specific deployments configured.") destination_configs = self.yaml["deployments"] if nickname not in destination_configs: text = "No deployment named {}. Valid deployments: {}." keys = ", ".join(destination_configs.keys()) raise ValueError(text.format(nickname, keys)) deployment_params = destination_configs[nickname] kind = deployment_params.pop("destination") try: config = destination_configs[nickname] deployment = deployments.make_deployment(kind, config, name=nickname) except TypeError: logging.exception("Invalid deployment parameters.") raise deployment.pod = self return deployment
def get_deployment(self, nickname): """Returns a pod-specific deployment.""" # Lazy import avoids environment errors and speeds up importing. from grow.deployments import deployments if 'deployments' not in self.yaml: raise ValueError('No pod-specific deployments configured.') destination_configs = self.yaml['deployments'] if nickname not in destination_configs: text = 'No deployment named {}. Valid deployments: {}.' keys = ', '.join(destination_configs.keys()) raise ValueError(text.format(nickname, keys)) deployment_params = destination_configs[nickname] kind = deployment_params.pop('destination') try: config = destination_configs[nickname] deployment = deployments.make_deployment(kind, config, name=nickname) except TypeError: logging.exception('Invalid deployment parameters.') raise deployment.pod = self return deployment
def get_deployment(self, nickname): """Returns a pod-specific deployment.""" if 'deployments' not in self.yaml: raise ValueError('No pod-specific deployments configured.') destination_configs = self.yaml['deployments'] if nickname not in destination_configs: text = 'No deployment named {}. Valid deployments: {}.' raise ValueError( text.format(nickname, ', '.join(destination_configs.keys()))) deployment_params = destination_configs[nickname] kind = deployment_params.pop('destination') try: config = destination_configs[nickname] deployment = deployments.make_deployment(kind, config, name=nickname) except TypeError: logging.exception('Invalid deployment parameters.') raise if deployment.config.keep_control_dir: deployment.pod = self return deployment
def get_deployment(self, nickname): """Returns a pod-specific deployment.""" # Lazy import avoids environment errors and speeds up importing. from grow.deployments import deployments if 'deployments' not in self.yaml: raise ValueError('No pod-specific deployments configured.') destination_configs = self.yaml['deployments'] if nickname not in destination_configs: text = 'No deployment named {}. Valid deployments: {}.' keys = ', '.join(destination_configs.keys()) raise ValueError(text.format(nickname, keys)) deployment_params = destination_configs[nickname] kind = deployment_params.pop('destination') try: config = destination_configs[nickname] deployment = deployments.make_deployment( kind, config, name=nickname) except TypeError: logging.exception('Invalid deployment parameters.') raise deployment.pod = self return deployment