# Copyright(c) 2016, Oracle and/or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import traceback import kollacli.i18n as u from kollacli.api.client import ClientApi from kollacli.commands.exceptions import CommandError from kollacli.common import utils from cliff.command import Command from cliff.lister import Lister CLIENT = ClientApi() def _get_names(args_list): csv_list = args_list[0].strip() names = utils.convert_to_unicode(csv_list).split(',') if 'all' in names: names = None return names class PropertySet(Command): "Property Set" def get_parser(self, prog_name): parser = super(PropertySet, self).get_parser(prog_name) parser.add_argument('propertyname', metavar='', help=u._('Property name')) parser.add_argument('propertyvalue', metavar=' property_length): if self.is_all_flag: include_prop = True else: include_prop = True if not include_prop: continue ovr_global = '-' ovr_group = '-' ovr_host = '-' if prop.ovr_global: ovr_global = '*' if prop.ovr_group: ovr_group = 'G' if prop.ovr_host: ovr_host = 'H' prop_ovr = ovr_global + ovr_group + ovr_host if self.is_long_flag: if self.is_global: data.append((prop_ovr, prop.name, prop.value, prop.orig_value)) else: data.append((prop_ovr, prop.name, prop.value, prop.orig_value, prop.target)) else: if self.is_global: data.append((prop_ovr, prop.name, prop.value)) else: data.append((prop_ovr, prop.name, prop.value, prop.target)) else: if self.is_long_flag: if self.is_global: data.append(('', '', '', '')) else: data.append(('', '', '', '', '')) else: if self.is_global: data.append(('', '', '')) else: data.append(('', '', '', '')) return data