Revision 3ed6dbde kamaki/cli/commands/pithos.py

b/kamaki/cli/commands/pithos.py
198 198
            'Set user account (not permanent)',
199 199
            ('-A', '--account'))
200 200

  
201
    def _run(self):
201
    def _run(self, custom_account=None):
202 202
        super(_file_account_command, self)._run()
203
        if self['account']:
203
        if custom_account:
204
            self.client.account = custom_account
205
        elif self['account']:
204 206
            self.client.account = self['account']
205 207

  
206 208
    @errors.generic.all
......
484 486
        versioning=ValueArgument(
485 487
            'set container versioning (auto/none)',
486 488
            '--versioning'),
487
        quota=IntArgument('set default container quota', '--quota'),
489
        limit=IntArgument('set default container limit', '--limit'),
488 490
        meta=KeyValueArgument(
489 491
            'set container metadata (can be repeated)',
490 492
            '--meta')
......
495 497
    @errors.pithos.container
496 498
    def _run(self):
497 499
        self.client.container_put(
498
            quota=self['quota'],
500
            limit=self['limit'],
499 501
            versioning=self['versioning'],
500 502
            metadata=self['meta'])
501 503

  
......
1745 1747

  
1746 1748
@command(pithos_cmds)
1747 1749
class file_quota(_file_account_command):
1748
    """Get quota for account or container"""
1750
    """Get account quota"""
1749 1751

  
1750 1752
    arguments = dict(
1751 1753
        in_bytes=FlagArgument('Show result in bytes', ('-b', '--bytes'))
......
1753 1755

  
1754 1756
    @errors.generic.all
1755 1757
    @errors.pithos.connection
1756
    @errors.pithos.container
1757 1758
    def _run(self):
1758
        if self.container:
1759
            reply = self.client.get_container_quota(self.container)
1760
        else:
1761
            reply = self.client.get_account_quota()
1759
        reply = self.client.get_account_quota()
1762 1760
        if not self['in_bytes']:
1763 1761
            for k in reply:
1764 1762
                reply[k] = format_size(reply[k])
1765 1763
        print_dict(pretty_keys(reply, '-'))
1766 1764

  
1767
    def main(self, container=None):
1768
        super(self.__class__, self)._run()
1769
        self.container = container
1765
    def main(self, custom_uuid=None):
1766
        super(self.__class__, self)._run(custom_account=custom_uuid)
1770 1767
        self._run()
1771 1768

  
1772 1769

  
......
1776 1773

  
1777 1774

  
1778 1775
@command(pithos_cmds)
1776
class file_containerlimit_get(_file_container_command):
1777
    """Get container size limit"""
1778

  
1779
    arguments = dict(
1780
        in_bytes=FlagArgument('Show result in bytes', ('-b', '--bytes'))
1781
    )
1782

  
1783
    @errors.generic.all
1784
    @errors.pithos.container
1785
    def _run(self):
1786
        reply = self.client.get_container_limit(self.container)
1787
        if not self['in_bytes']:
1788
            for k in reply:
1789
                reply[k] = format_size(reply[k])
1790
        print_dict(pretty_keys(reply, '-'))
1791

  
1792
    def main(self, container=None):
1793
        super(self.__class__, self)._run()
1794
        self.container = container
1795
        self._run()
1796

  
1797

  
1798
@command(pithos_cmds)
1779 1799
class file_containerlimit_set(_file_account_command):
1780 1800
    """Set new storage limit for a container
1781 1801
    By default, the limit is set in bytes
1782 1802
    Users may specify a different unit, e.g:
1783 1803
    /file containerlimit set 2.3GB mycontainer
1784
    Valide units: B, KiB (1024 B), KB (1000 B), MiB, MB, GiB, GB, TiB, TB
1804
    Valid units: B, KiB (1024 B), KB (1000 B), MiB, MB, GiB, GB, TiB, TB
1785 1805
    """
1786 1806

  
1787 1807
    @errors.generic.all

Also available in: Unified diff