1
# Licensed under the Apache License, Version 2.0 (the "License");
2
# you may not use this file except in compliance with the License.
3
# You may obtain a copy of the License at
5
# http://www.apache.org/licenses/LICENSE-2.0
7
# Unless required by applicable law or agreed to in writing, software
8
# distributed under the License is distributed on an "AS IS" BASIS,
9
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
# See the License for the specific language governing permissions and
11
# limitations under the License.
12
# from charmhelpers.core import hookenv
13
from charms.reactive import hook
14
from charms.reactive import RelationBase
15
from charms.reactive import scopes
18
class WXSRequires(RelationBase):
21
auto_accessors = ['wxs_catalog_ip', 'wxs_catalog_port']
23
@hook('{requires:ibm-wxs}-relation-joined')
25
self.set_state('{relation_name}.available')
27
@hook('{requires:ibm-wxs}-relation-changed')
29
print("Status is ibm-wxs.available in requires")
30
if str(self.get_remote('wxs_catalog_port')) != "None":
31
self.set_state('{relation_name}.ready')
32
print("Status is relation_name.available in requires")
34
@hook('{requires:ibm-wxs}-relation-departed')
36
self.remove_state('{relation_name}.available')
37
self.remove_state('{relation_name}.ready')
39
def get_wxs_catalog_port(self):
40
return self.get_remote('wxs_catalog_port')
42
def get_wxs_catalog_ip(self):
43
return self.get_remote('wxs_catalog_ip')