Ubuntu Pastebin

Paste from LSF Storage Provides.py at Mon, 28 Mar 2016 18:06:48 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from charmhelpers.core import hookenv
from charms.reactive import hook
from charms.reactive import RelationBase
from charms.reactive import scopes


class nfsstorageProvides(RelationBase):
    # Every unit connecting will get the same information
    scope = scopes.UNIT

    # Use some template magic to declare our relation(s)
    @hook('{provides:nfsstorage}-relation-joined')
    def joined(self):
        print("I am in relation joined state for provides")
        self.set_state('{relation_name}.joined')

    @hook('{provides:nfsstorage}-relation-changed')
    def changed(self):
        print("I am in relation changed avaialble state for provides")
        self.set_state('{relation_name}.available')
        

    @hook('{provides:nfsstorage}-relation-departed')
    def departed(self):
        # Remove the state that our relationship is now available to our principal layer(s)
        self.remove_state('{relation_name}.joined')
        self.remove_state('{relation_name}.available')

    def host_name(self, hostname_storage):
        self.set_remote(data={
            'hostname_storage': hostname_storage,
    })


       
    def nfsclient_ip(self):
        return self.get_remote('private-address') 
        
Download as text