Permalink
Browse files

741595 - uebercert POST/GET/DELETE - either support or delete the cal…

…ls from CLI
  • Loading branch information...
1 parent 6f5c262 commit 8502a2b98ec057928b7ff0ac03cee20934d82fc7 Petr Chalupa committed Apr 17, 2012
@@ -48,9 +48,9 @@ def organization(self, name):
org = self.server.GET(path)[1]
return org
- def uebercert(self, name):
+ def uebercert(self, name, regenerate=False):
path = "/api/organizations/%s/uebercert" % u_str(name)
- return self.server.GET(path)[1]
+ return self.server.GET(path, {'regenerate':regenerate})[1]
def pools(self, name):
path = "/api/owners/%s/pools" % u_str(name)
@@ -174,14 +174,17 @@ class GenerateDebugCert(OrganizationAction):
def setup_parser(self):
self.parser.add_option('--name', dest='name',
help=_("organization name eg: foo.example.com (required)"))
+ self.parser.add_option("--regenerate", dest="regenerate", action="store_true",
+ help=_("regenerate the certificate"))
def check_options(self):
self.require_option('name')
def run(self):
name = self.get_option('name')
+ regenerate = self.get_option('regenerate')
- uebercert = self.api.uebercert(name)
+ uebercert = self.api.uebercert(name, regenerate)
self.printer.add_column('key')
self.printer.add_column('cert')
@@ -35,4 +35,4 @@ def tearDown(self):
def test_generates_uebercert_in_cp(self):
self.action.run()
- self.action.api.uebercert.assert_called_once_with(self.NAME)
+ self.action.api.uebercert.assert_called_once_with(self.NAME, None)
@@ -16,13 +16,12 @@ class Api::UebercertsController < Api::ApiController
before_filter :authorize
def rules
- read_test = lambda{ @organization.readable? }
- {
- :show => read_test,
- }
+ read_test = lambda { @organization.readable? }
+ { :show => read_test }
end
def show
+ @organization.generate_debug_cert if params[:regenerate] == 'True'
render :json => @organization.debug_cert
end
end

0 comments on commit 8502a2b

Please sign in to comment.