How to use the juju.constraints.normalize_key function in juju

To help you get started, we’ve selected a few juju examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conjure-up / conjure-up / conjureup / ui / views / applicationconfigure.py View on Github external
def submit(self):
        if self.constraints_copy:
            try:
                parsed = set(parse_constraints(self.constraints_copy))
            except ValueError:
                return self.set_constraints_error()
            has_valid_constraints = parsed.issubset(
                {normalize_key(field) for field in consts.ALLOWED_CONSTRAINTS})
            if not has_valid_constraints:
                return self.set_constraints_error()

        self.application.options = self.options_copy
        self.application.num_units = self.num_units_copy
        self.application.constraints = self.constraints_copy
        # Replace application data with updated info
        new_data = self.application.to_dict()
        app.current_bundle['applications'][self.application.name] = new_data

        self.prev_screen()