Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
karencfv committed Mar 1, 2024
1 parent bf1e9f7 commit 169bef9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 42 deletions.
16 changes: 3 additions & 13 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2021,13 +2021,12 @@ impl ServiceManager {
.net()
.to_string();

let dns_install_service = Self::dns_install(info, Some(dns_servers.to_vec()), domain).await?;
// let domain = if let Some(d) = domain { d } else { "unknown" };
let dns_install_service =
Self::dns_install(info, Some(dns_servers.to_vec()), domain)
.await?;

let mut ntp_config = PropertyGroupBuilder::new("config")
.add_property("allow", "astring", &rack_net)
// TODO: perhaps remove this property
.add_property("domain", "astring", "domain")
.add_property(
"boundary",
"boolean",
Expand All @@ -2042,15 +2041,6 @@ impl ServiceManager {
);
}

// TODO: Remove these
for s in dns_servers.clone() {
ntp_config = ntp_config.clone().add_property(
"dns_server",
"astring",
&s.to_string(),
);
}

let dns_client_service;
if dns_servers.is_empty() {
dns_client_service =
Expand Down
2 changes: 0 additions & 2 deletions smf/ntp/manifest/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@
<propval name="file" type="astring" value="/etc/inet/chrony.conf" />
<propval name="boundary" type="boolean" value="false" />
<propval name="server" type="astring" value="" />
<propval name="dns_server" type="astring" value="" />
<propval name="allow" type="astring" value="" />
<propval name="domain" type="astring" value="unknown" />
</property_group>

<stability value="Unstable" />
Expand Down
28 changes: 1 addition & 27 deletions smf/ntp/method/svc-site-ntp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function config { die $SMF_EXIT_ERR_CONFIG "$@"; }
typeset -r action=${1:?action parameter not specified}
typeset -r contract=$2 # For the refresh and stop methods

for var in file boundary server allow domain dns_server; do
for var in file boundary server allow; do
nameref _var=$var

typeset _var=`svcprop -p config/$var $SMF_FMRI`
Expand Down Expand Up @@ -106,39 +106,13 @@ function update_logadm {
svcadm refresh logadm-upgrade
}

function configure_dns_client {
# TODO: It seems svc:/network/dns/client:default is enabled before this file
# gets a chance to be populated. The service only starts if I git it an empty
# resolv.conf file in advance.
# TODO: Remove the empty resolve.conf file
if [[ $boundary == true ]]; then
echo "* Generating resolv.conf file"
if [[ $domain != "unknown" ]]; then
echo "domain $domain" >> /etc/resolv.conf
fi

for s in $dns_server; do
echo "nameserver $s" >> /etc/resolv.conf
done

echo "* Copying nsswitch.dns to nsswitch.conf"
cp /etc/nsswitch.dns /etc/nsswitch.conf

# TODO: Perhaps we keep these?
# svcadm refresh -t svc:/network/dns/client
# svcadm enable -t svc:/network/dns/client
fi
}

case $action in
start)
# configure_dns_client
generate_config_file
update_logadm
start_daemon
;;
refresh)
# configure_dns_client
generate_config_file && stop_daemon
# SMF will restart the service since the contract is now empty.
;;
Expand Down

0 comments on commit 169bef9

Please sign in to comment.