Skip to content

Commit 0afc935

Browse files
authored
Merge pull request #2 from timogoebel/superfluous_raise
remove superfluous exception handling
2 parents eb24062 + 3528ee8 commit 0afc935

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

lib/smart_proxy_realm_ad/provider.rb

+10-18
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,11 @@ def create realm, hostfqdn, params
3333
password = generate_password
3434
result = { :randompassword => password }
3535

36-
begin
37-
if params[:rebuild] == "true"
38-
do_host_rebuild hostfqdn, password
39-
else
40-
do_host_create hostfqdn, password
41-
end
42-
rescue
43-
raise
44-
end
36+
if params[:rebuild] == "true"
37+
do_host_rebuild hostfqdn, password
38+
else
39+
do_host_create hostfqdn, password
40+
end
4541

4642
JSON.pretty_generate(result)
4743
end
@@ -50,11 +46,7 @@ def delete realm, hostfqdn
5046
logger.info "Proxy::AdRealm: delete... #{realm}, #{hostfqdn}"
5147
kinit_radcli_connect
5248
check_realm realm
53-
begin
54-
radcli_delete hostfqdn
55-
rescue Adcli::AdEnroll::Exception =>
56-
raise
57-
end
49+
radcli_delete hostfqdn
5850
end
5951

6052
private
@@ -63,10 +55,10 @@ def hostfqdn_to_hostname host_fqdn
6355
begin
6456
host_fqdn_split = host_fqdn.split('.')
6557
host_fqdn_split[0]
66-
rescue
67-
logger.debug "hostfqdn_to_hostname error"
68-
raise
69-
end
58+
rescue => e
59+
logger.debug "hostfqdn_to_hostname error: #{e}"
60+
raise e
61+
end
7062
end
7163

7264
def do_host_create hostfqdn, password

0 commit comments

Comments
 (0)