1 # Copyright 2020 Canonical Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from charms
.reactive
import Endpoint
15 from charms
.reactive
import when
16 from charms
.reactive
import set_flag
, clear_flag
19 class KeystoneProvides(Endpoint
):
20 @when("endpoint.{endpoint_name}.joined")
22 set_flag(self
.expand_name("{endpoint_name}.joined"))
24 @when("endpoint.{endpoint_name}.changed")
26 set_flag(self
.expand_name("{endpoint_name}.ready"))
28 @when("endpoint.{endpoint_name}.departed")
30 set_flag(self
.expand_name("{endpoint_name}.departed"))
31 clear_flag(self
.expand_name("{endpoint_name}.joined"))
48 for relation
in self
.relations
:
49 relation
.to_publish
["host"] = host
50 relation
.to_publish
["port"] = port
51 relation
.to_publish
["keystone_db_password"] = keystone_db_password
52 relation
.to_publish
["region_id"] = region_id
53 relation
.to_publish
["user_domain_name"] = user_domain_name
54 relation
.to_publish
["project_domain_name"] = project_domain_name
55 relation
.to_publish
["admin_username"] = admin_username
56 relation
.to_publish
["admin_password"] = admin_password
57 relation
.to_publish
["admin_project_name"] = admin_project_name
58 relation
.to_publish
["username"] = username
59 relation
.to_publish
["password"] = password
60 relation
.to_publish
["service"] = service
62 def mark_complete(self
):
63 clear_flag(self
.expand_name("{endpoint_name}.joined"))