예제 #1
0
파일: master.py 프로젝트: ceache/treadmill
    def configure(group, count):
        """Create, get or modify identity group configuration"""
        zkclient = context.GLOBAL.zk.conn
        if count is not None:
            masterapi.update_identity_group(zkclient, group, count)

        cli.out(formatter(masterapi.get_identity_group(zkclient, group)))
예제 #2
0
파일: master.py 프로젝트: ceache/treadmill
    def _list():
        """List all configured identity groups"""
        zkclient = context.GLOBAL.zk.conn
        groups = [
            masterapi.get_identity_group(zkclient, group)
            for group in masterapi.identity_groups(zkclient)
        ]

        cli.out(formatter(groups))
예제 #3
0
        def _list(match=None):
            """List configured identity groups."""
            if match is None:
                match = '*'

            zkclient = context.GLOBAL.zk.conn
            groups = [
                masterapi.get_identity_group(zkclient, group)
                for group in masterapi.identity_groups(zkclient)
            ]

            filtered = [
                group for group in groups
                if group is not None and fnmatch.fnmatch(group['_id'], match)
            ]
            return sorted(filtered, key=lambda item: item['_id'])
예제 #4
0
 def update(rsrc_id, rsrc):
     """Update application configuration."""
     zkclient = context.GLOBAL.zk.conn
     masterapi.update_identity_group(zkclient, rsrc_id, rsrc['count'])
     return masterapi.get_identity_group(zkclient, rsrc_id)
예제 #5
0
 def create(rsrc_id, rsrc):
     """Create (configure) application group."""
     zkclient = context.GLOBAL.zk.conn
     masterapi.update_identity_group(zkclient, rsrc_id, rsrc['count'])
     return masterapi.get_identity_group(zkclient, rsrc_id)
예제 #6
0
 def get(rsrc_id):
     """Get application group configuration."""
     zkclient = context.GLOBAL.zk.conn
     return masterapi.get_identity_group(zkclient, rsrc_id)