File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -134,16 +134,13 @@ let refresh_localhost_info ~__context info =
134
134
) else
135
135
Db.Host. remove_from_other_config ~__context ~self: host
136
136
~key: Xapi_globs. host_no_local_storage ;
137
- let script_output =
138
- Helpers. call_script ! Xapi_globs. firewall_port_config_script [" check" ; " 80" ]
137
+ let module F =
138
+ ( val Firewall. firewall_provider ! Xapi_globs. firewall_backend
139
+ : Firewall. FIREWALL
140
+ )
139
141
in
140
- try
141
- let network_state = Scanf. sscanf script_output " Port 80 open: %B" Fun. id in
142
- Db.Host. set_https_only ~__context ~self: host ~value: network_state
143
- with _ ->
144
- Helpers. internal_error
145
- " unexpected output from /etc/xapi.d/plugins/firewall-port: %s"
146
- script_output
142
+ let enabled = F. is_firewall_service_enabled ~service: Firewall. Http in
143
+ Db.Host. set_https_only ~__context ~self: host ~value: (not enabled)
147
144
(* ************** update database tools ******************)
148
145
149
146
(* * Record host memory properties in database *)
Original file line number Diff line number Diff line change @@ -3116,13 +3116,17 @@ let cc_prep () =
3116
3116
true
3117
3117
3118
3118
let set_https_only ~__context ~self ~value =
3119
- let state = match value with true -> " close" | false -> " open" in
3120
3119
match cc_prep () with
3121
3120
| false ->
3122
- ignore
3123
- @@ Helpers. call_script
3124
- ! Xapi_globs. firewall_port_config_script
3125
- [state; " 80" ] ;
3121
+ let status =
3122
+ match value with true -> Firewall. Disabled | false -> Firewall. Enabled
3123
+ in
3124
+ let module F =
3125
+ ( val Firewall. firewall_provider ! Xapi_globs. firewall_backend
3126
+ : Firewall. FIREWALL
3127
+ )
3128
+ in
3129
+ F. update_firewall_status ~service: Firewall. Http ~status ;
3126
3130
Db.Host. set_https_only ~__context ~self ~value
3127
3131
| true when value = Db.Host. get_https_only ~__context ~self ->
3128
3132
(* the new value is the same as the old value *)
You can’t perform that action at this time.
0 commit comments