Exemple #1
0
    def func_include(*args):
        """
        Builtin Func: Include

        .. code-block:: javascript

            {
                "$<Include>": [ "a.json", "b.json" ]
            }
        """
        if isinstance(args, basestring):
            return JsonSub.fp_to_json(open(args, "r"))

        elif isinstance(args, tuple):
            text = {}
            for value in args:
                if not isinstance(value, basestring):
                    break
                log.debug("Including the config file: %s" % value)
                text = dict_merge(text, json.load(open(value, "r")))
            else:
                return text

        raise IcsException("Invalid parameters found: (%s)" % (
            args))
Exemple #2
0
    def func_include(*args):
        """
        Builtin Func: Include

        .. code-block:: javascript

            {
                "$<Include>": [ "a.json", "b.json" ]
            }
        """
        if isinstance(args, basestring):
            return JsonSub.fp_to_json(open(args, "r"))

        elif isinstance(args, tuple):
            text = {}
            for value in args:
                if not isinstance(value, basestring):
                    break
                log.debug("Including the config file: %s" % value)
                text = dict_merge(text, json.load(open(value, "r")))
            else:
                return text

        raise IcsException("Invalid parameters found: (%s)" % (args))
Exemple #3
0
        try:
            group_data = clean_empty_items(self.fetch_group(group_name))
        except Exception, e:
            log.error(e)
            return False

        lc_name = group_data['LaunchConfigurationName']
        try:
            launch_data = clean_empty_items(self.fetch_launch_config(lc_name))
        except Exception, e:
            log.error(e)
            return False

        # FIXME: trick to remove user-data
        user_data = launch_config.pop('UserData')
        launch_config = dict_merge(launch_data, launch_config)

        # FIXME: need to refine and remove the unused items
        launch_config['UserData'] = user_data
        if 'CreatedTime' in launch_config:
            launch_config.pop('CreatedTime')
        if 'LaunchConfigurationARN' in launch_config:
            launch_config.pop('LaunchConfigurationARN')

        if launch_config == launch_data:
            log.info("no need to update the launch configuration")
        else:
            try:
                new_lc_name = self.modify_launch_config(launch_config)
                group_config['LaunchConfigurationName'] = new_lc_name
            except Exception, e: