コード例 #1
0
ファイル: __init__.py プロジェクト: xueweiz/sos
 def _get_options(self):
     """Loads the options defined by a cluster and sets the default value"""
     for opt in self.option_list:
         option = ClusterOption(name=opt[0], opt_type=opt[1].__class__,
                                value=opt[1], cluster=self.cluster_type,
                                description=opt[2])
         self.options.append(option)
コード例 #2
0
ファイル: __init__.py プロジェクト: xueweiz/sos
    def parse_cluster_options(self):
        opts = []
        if not isinstance(self.opts.cluster_options, list):
            self.opts.cluster_options = [self.opts.cluster_options]
        if self.opts.cluster_options:
            for option in self.opts.cluster_options:
                cluster = option.split('.')[0]
                name = option.split('.')[1].split('=')[0]
                try:
                    # there are no instances currently where any cluster option
                    # should contain a legitimate space.
                    value = option.split('=')[1].split()[0]
                except IndexError:
                    # conversion to boolean is handled during validation
                    value = 'True'

                opts.append(
                    ClusterOption(name, value, value.__class__, cluster))
        self.opts.cluster_options = opts