Ejemplo n.º 1
0
    def __init__(self, ctx, args):
        super(CDNMode, self).__init__('cdn')

        self.cdnname = args[0]

        try:
            self.cdn = CDN.by_name(ctx, self.cdnname)
        except CDN.NotFound:
            self.cdn = CDN(ctx, {
                'name': self.cdnname,
                'flavor_id': 'cdn',
                'origins': [],
                'domains': []
            })
            self.cdn._modified = True
            sys.stdout.write("% Creating new CDN.\n")

        self.add_commands([
            [ "name", None, "Set CDN name" ],
            [ "name <name>", self.c_name ],
            [ "flavour", None, "Set CDN flavour" ],
            [ "flavour <name>", self.c_flavour ],
            [ "log-delivery", self.c_enable_log_delivery, "Enable log delivery" ],
            [ "no log-delivery", self.c_disable_log_delivery, "Disable log delivery" ],
            [ "commit", self.c_commit, "Commit changes" ],
        ])
Ejemplo n.º 2
0
def c_purge(p, ctx, args, hard=False):
    try:
        c = CDN.by_name(ctx, args[0])
    except CDN.NotFound, e:
        raise cli.CLIError(str(e))
Ejemplo n.º 3
0
def c_show_cdn(p, ctx, args):
    try:
        c = CDN.by_name(ctx, args[0])
    except CDN.NotFound, e:
        raise cli.CLIError(str(e))