diff options
author | WuKong <rebirthmonkey@gmail.com> | 2015-09-23 14:30:45 +0200 |
---|---|---|
committer | WuKong <rebirthmonkey@gmail.com> | 2015-09-23 14:30:45 +0200 |
commit | 4c39eb93dee5f48bff4c59aa9ec74cfa4027a297 (patch) | |
tree | d3694184380bd1b823db17faa20e45894a8322b8 /moonclient | |
parent | 480d0fb4390de27b225722e72cb95686f5c42ff8 (diff) |
finish moonclient-review2, only problem about intra-extension
Change-Id: I2867ca2ce1498dd06cbdd0d6b672a5cb2e920f37
Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/metarules.py | 41 | ||||
-rw-r--r-- | moonclient/moonclient/rules.py | 26 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_configuration.json | 24 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_submetarules.json | 4 | ||||
-rw-r--r-- | moonclient/python_moonclient.egg-info/PKG-INFO | 4 | ||||
-rw-r--r-- | moonclient/python_moonclient.egg-info/SOURCES.txt | 7 | ||||
-rw-r--r-- | moonclient/setup.py | 20 |
7 files changed, 39 insertions, 87 deletions
diff --git a/moonclient/moonclient/metarules.py b/moonclient/moonclient/metarules.py index a29ab45f..9677c5f6 100644 --- a/moonclient/moonclient/metarules.py +++ b/moonclient/moonclient/metarules.py @@ -148,11 +148,11 @@ class SubMetaRuleSet(Command): parser = super(SubMetaRuleSet, self).get_parser(prog_name) parser.add_argument( 'submetarule_id', - metavar='<sub_meta_rule-uuid>', + metavar='<sub-meta-rule-uuid>', help='Sub Meta Rule UUID (example: "12346")', ) parser.add_argument( - '--algorithm', + '--algorithm_name', metavar='<algorithm-str>', help='algorithm to use (example: "inclusion")', ) @@ -198,44 +198,17 @@ class SubMetaRuleSet(Command): subject_category_id = map(lambda x: x.strip(), subject_category_id.split(',')) action_category_id = map(lambda x: x.strip(), action_category_id.split(',')) object_category_id = map(lambda x: x.strip(), object_category_id.split(',')) - sub_meta_rule_id = parsed_args.id + sub_meta_rule_id = parsed_args.submetarule_id post_data = dict() post_data["sub_meta_rule_name"] = parsed_args.name - post_data["sub_meta_rule_algorithm"] = parsed_args.algorithm - post_data["sub_meta_rule_subject_categories"] = filter(lambda x: x, subject_category_id) # TODO: check for multiple categories + post_data["sub_meta_rule_algorithm"] = parsed_args.algorithm_name + post_data["sub_meta_rule_subject_categories"] = filter(lambda x: x, subject_category_id) post_data["sub_meta_rule_object_categories"] = filter(lambda x: x, object_category_id) post_data["sub_meta_rule_action_categories"] = filter(lambda x: x, action_category_id) - self.app.get_url("/v3/OS-MOON/intra_extensions/{}/sub_meta_rules/{}".format(parsed_args.intraextension, sub_meta_rule_id), + self.app.get_url("/v3/OS-MOON/intra_extensions/{}/sub_meta_rules/{}".format(parsed_args.intraextension, + sub_meta_rule_id), post_data=post_data, method="POST", authtoken=True) -class SubMetaRuleRelationList(Lister): - """List all sub meta rule relations.""" - - log = logging.getLogger(__name__) - - def get_parser(self, prog_name): - parser = super(SubMetaRuleRelationList, self).get_parser(prog_name) - parser.add_argument( - '--intraextension', - metavar='<intraextension-uuid>', - help='IntraExtension UUID', - ) - return parser - - def take_action(self, parsed_args): - if not parsed_args.intraextension: - parsed_args.intraextension = self.app.intraextension - data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/sub_meta_rule_relations".format( - parsed_args.intraextension), - authtoken=True) - if "sub_meta_rule_relations" not in data: - raise Exception("Error in command {}: {}".format("AggregationAlgorithmList", data)) - return ( - ("sub_meta_rule_relations",), - ((_uuid, ) for _uuid in data["sub_meta_rule_relations"]) - ) - - diff --git a/moonclient/moonclient/rules.py b/moonclient/moonclient/rules.py index dcf1a8f0..682c830d 100644 --- a/moonclient/moonclient/rules.py +++ b/moonclient/moonclient/rules.py @@ -131,11 +131,6 @@ class RuleAdd(Command): metavar='<submetarule-uuid>', help='Sub Meta Rule UUID', ) - # parser.add_argument( - # 'relation', - # metavar='<relation-uuid>', - # help='Relation UUID', - # ) parser.add_argument( 'rule', metavar='<argument-list>', @@ -148,24 +143,6 @@ class RuleAdd(Command): ) return parser - # def __get_subject_category_name(self, intraextension, category_id): - # data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_categories".format(intraextension), - # authtoken=True) - # if category_id in data: - # return data[category_id]["name"] - # - # def __get_object_category_name(self, intraextension, category_id): - # data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/object_categories".format(intraextension), - # authtoken=True) - # if category_id in data: - # return data[category_id]["name"] - # - # def __get_action_category_name(self, intraextension, category_id): - # data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/action_categories".format(intraextension), - # authtoken=True) - # if category_id in data: - # return data[category_id]["name"] - def __get_subject_scope_id(self, intraextension, category_id, scope_name): data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subject_scopes/{}".format(intraextension, category_id), authtoken=True) @@ -261,4 +238,5 @@ class RuleDelete(Command): rule_id=parsed_args.rule_id ), method="DELETE", - authtoken=True) + authtoken=True + ) diff --git a/moonclient/moonclient/tests/tests_configuration.json b/moonclient/moonclient/tests/tests_configuration.json index 5c599b1d..c470cc1c 100644 --- a/moonclient/moonclient/tests/tests_configuration.json +++ b/moonclient/moonclient/tests/tests_configuration.json @@ -57,22 +57,22 @@ }, { - "name": "get_templates", - "command": "templates list", + "name": "list template", + "command": "template list", "result": "policy_root", "description": "Check that we have the root policy templates", "command_options": "-c id -f value" }, { - "name": "list_aggregation_algorithms", - "command": "aggregation algorithms list", + "name": "list aggregation_algorithm", + "command": "aggregation algorithm list", "result": "all_true", "description": "Check that the aggregation algorithm all_true exists.", "command_options": "-c name -f value" }, { - "name": "list_submetarule_algorithms", - "command": "submetarule algorithms list", + "name": "list submetarule_algorithm", + "command": "submetarule algorithm list", "result": "comparison", "description": "Check that the aggregation algorithm all_true exists.", "command_options": "-c name -f value" @@ -183,22 +183,22 @@ }, { - "name": "get_templates", - "command": "templates list", + "name": "lst template", + "command": "template list", "result": "policy_root", "description": "Check that we have the root policy templates", "command_options": "-c id -f value" }, { - "name": "list_aggregation_algorithms", - "command": "aggregation algorithms list", + "name": "list aggregation_algorithm", + "command": "aggregation algorithm list", "result": "all_true", "description": "Check that the aggregation algorithm all_true exists.", "command_options": "-c name -f value" }, { - "name": "list_submetarule_algorithms", - "command": "submetarule algorithms list", + "name": "list submetarule_algorithm", + "command": "submetarule algorithm list", "result": "comparison", "description": "Check that the aggregation algorithm all_true exists.", "command_options": "-c name -f value" diff --git a/moonclient/moonclient/tests/tests_submetarules.json b/moonclient/moonclient/tests/tests_submetarules.json index 093cbcf2..64ca86ff 100644 --- a/moonclient/moonclient/tests/tests_submetarules.json +++ b/moonclient/moonclient/tests/tests_submetarules.json @@ -79,7 +79,7 @@ }, { "name": "set_submetarule", - "command": "submetarule set $submetarule_uuid --subject_categories=\"$category_level_uuid,$category_domain_uuid\"", + "command": "submetarule set $submetarule_uuid --subject_category_id=\"$category_level_uuid,$category_domain_uuid\"", "result": "^$", "description": "Set a new submetarule", "command_options": "" @@ -238,7 +238,7 @@ }, { "name": "set_submetarule", - "command": "submetarule set $submetarule_uuid --subject_categories=\"$category_level_uuid,$category_domain_uuid\"", + "command": "submetarule set $submetarule_uuid --subject_category_id=\"$category_level_uuid,$category_domain_uuid\"", "result": "^$", "description": "Set a new submetarule", "command_options": "" diff --git a/moonclient/python_moonclient.egg-info/PKG-INFO b/moonclient/python_moonclient.egg-info/PKG-INFO index aaeb0c16..1045d986 100644 --- a/moonclient/python_moonclient.egg-info/PKG-INFO +++ b/moonclient/python_moonclient.egg-info/PKG-INFO @@ -15,11 +15,13 @@ Description: Moon Client * `sudo python setup.py install` + * `cd ~/devstack || source openrc admin` + Manipulation ------------ - * `keystone moon` + * `moon tenant list` diff --git a/moonclient/python_moonclient.egg-info/SOURCES.txt b/moonclient/python_moonclient.egg-info/SOURCES.txt index 6390f4da..656a639e 100644 --- a/moonclient/python_moonclient.egg-info/SOURCES.txt +++ b/moonclient/python_moonclient.egg-info/SOURCES.txt @@ -1,11 +1,10 @@ MANIFEST.in README.rst -setup.cfg setup.py moonclient/__init__.py moonclient/action_assignments.py moonclient/action_categories.py -moonclient/action_category_scope.py +moonclient/action_scopes.py moonclient/actions.py moonclient/configuration.py moonclient/intraextension.py @@ -13,13 +12,13 @@ moonclient/logs.py moonclient/metarules.py moonclient/object_assignments.py moonclient/object_categories.py -moonclient/object_category_scope.py +moonclient/object_scopes.py moonclient/objects.py moonclient/rules.py moonclient/shell.py moonclient/subject_assignments.py moonclient/subject_categories.py -moonclient/subject_category_scope.py +moonclient/subject_scopes.py moonclient/subjects.py moonclient/tenants.py moonclient/tests.py diff --git a/moonclient/setup.py b/moonclient/setup.py index 5e090529..44d89a9d 100644 --- a/moonclient/setup.py +++ b/moonclient/setup.py @@ -92,15 +92,15 @@ setup( 'action_category_list = moonclient.action_categories:ActionCategoriesList', 'action_category_add = moonclient.action_categories:ActionCategoriesAdd', 'action_category_delete = moonclient.action_categories:ActionCategoriesDelete', - 'subject_scope_list = moonclient.subject_scope:SubjectScopesList', - 'subject_scope_add = moonclient.subject_scope:SubjectScopesAdd', - 'subject_scope_delete = moonclient.subject_scope:SubjectScopesDelete', - 'object_scope_list = moonclient.object_scope:ObjectScopesList', - 'object_scope_add = moonclient.object_scope:ObjectScopesAdd', - 'object_scope_delete = moonclient.object_scope:ObjectScopesDelete', - 'action_scope_list = moonclient.action_scope:ActionScopesList', - 'action_scope_add = moonclient.action_scope:ActionScopesAdd', - 'action_scope_delete = moonclient.action_scope:ActionScopesDelete', + 'subject_scope_list = moonclient.subject_scopes:SubjectScopesList', + 'subject_scope_add = moonclient.subject_scopes:SubjectScopesAdd', + 'subject_scope_delete = moonclient.subject_scopes:SubjectScopesDelete', + 'object_scope_list = moonclient.object_scopes:ObjectScopesList', + 'object_scope_add = moonclient.object_scopes:ObjectScopesAdd', + 'object_scope_delete = moonclient.object_scopes:ObjectScopesDelete', + 'action_scope_list = moonclient.action_scopes:ActionScopesList', + 'action_scope_add = moonclient.action_scopes:ActionScopesAdd', + 'action_scope_delete = moonclient.action_scopes:ActionScopesDelete', 'subject_assignment_list = moonclient.subject_assignments:SubjectAssignmentsList', 'subject_assignment_add = moonclient.subject_assignments:SubjectAssignmentsAdd', 'subject_assignment_delete = moonclient.subject_assignments:SubjectAssignmentsDelete', @@ -116,7 +116,7 @@ setup( 'submetarule_show = moonclient.metarules:SubMetaRuleShow', 'submetarule_set = moonclient.metarules:SubMetaRuleSet', - 'submetarule_relation_list = moonclient.metarules:SubMetaRuleRelationList', + 'rule_list = moonclient.rules:RulesList', 'rule_add = moonclient.rules:RuleAdd', |