summaryrefslogtreecommitdiff
path: root/lorryctl
blob: 1be9341a567156526e4ddc7835961cf05f4f0b11 (plain)
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
# Prototype lorry-controller cli, to save remembering the HTTP API...


import cliapp
import requests


class CLI(cliapp.Application):
    def cmd_promote(self, args):
        '''Move a repo to the top of the processing queue.'''

        if len(args) != 1:
            raise cliapp.AppException(
                'This command takes one argument: the repo to promote.')

        url = 'http://localhost:12765/1.0/move-to-top'
        payload = {'path': args[0]}
        r = requests.post(url, data=payload)
        if r.ok:
            print r.text
        else:
            raise cliapp.AppException(r)


CLI().run()