Skip to content

Commit

Permalink
HEAD-427 separate config into a 'config' and a 'config.inc/defaults' …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
jjelinek committed May 24, 2011
1 parent 98f7f74 commit 14a8e60
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 30 deletions.
4 changes: 2 additions & 2 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ f lib/svc/manifest/system/ibsrp/target.xml 0444 root sys
f lib/svc/manifest/system/identity.xml 0444 root sys
f lib/svc/manifest/system/idmap.xml 0444 root sys
f lib/svc/manifest/system/intrd.xml 0444 root sys
f lib/svc/manifest/system/joyinit.xml 0444 root sys
f lib/svc/manifest/system/smartdc-init.xml 0444 root sys
f lib/svc/manifest/system/keymap.xml 0444 root sys
f lib/svc/manifest/system/labeld.xml 0444 root sys
f lib/svc/manifest/system/logadm-upgrade.xml 0444 root sys
Expand Down Expand Up @@ -1687,6 +1687,7 @@ f lib/svc/method/sendmail-client 0555 root sys
f lib/svc/method/slp 0555 root sys
f lib/svc/method/smartdc-beacon 0555 root bin
f lib/svc/method/smartdc-config 0555 root bin
f lib/svc/method/smartdc-init 0555 root sys
f lib/svc/method/smartdc-ur 0555 root bin
f lib/svc/method/smb-client 0555 root sys
f lib/svc/method/smtp-sendmail 0555 root sys
Expand All @@ -1710,7 +1711,6 @@ f lib/svc/method/svc-hostid 0555 root bin
f lib/svc/method/svc-hotplug 0555 root bin
f lib/svc/method/svc-ii 0744 root sys
f lib/svc/method/svc-intrd 0555 root sys
f lib/svc/method/svc-joyinit 0555 root sys
f lib/svc/method/svc-labeld 0555 root sys
f lib/svc/method/svc-legacy-routing 0555 root bin
f lib/svc/method/svc-lms 0555 root sys
Expand Down
15 changes: 11 additions & 4 deletions overlay/lib/sdc/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function sdc_config_keys_contain {
search=$1
load_sdc_config_filename
if [[ -f ${SDC_CONFIG_FILENAME} ]]; then
matches=$((cat ${SDC_CONFIG_FILENAME}; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | sed -e "s/=.*//" | grep $search | wc -l)
matches=$((cat ${SDC_CONFIG_FILENAME} ${SDC_CONFIG_INC_DIR}/generic; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | \
sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | \
sed -e "s/=.*//" | grep $search | wc -l)
if [[ $matches -eq 0 ]]; then
echo false
else
Expand All @@ -68,7 +70,9 @@ function sdc_config_keys_contain {
function sdc_config_keys {
load_sdc_config_filename
if [[ -f ${SDC_CONFIG_FILENAME} ]]; then
keys=$((cat ${SDC_CONFIG_FILENAME}; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | sed -e "s/=.*//")
keys=$((cat ${SDC_CONFIG_FILENAME} ${SDC_CONFIG_INC_DIR}/generic; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | \
sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | \
sed -e "s/=.*//")
fi
echo "${keys}"
}
Expand All @@ -86,9 +90,12 @@ function load_sdc_config {
fi
load_sdc_config_filename
# Ignore comments, spaces at the beginning of lines and lines that don't start with a letter.
# Ignore comments, spaces at the beginning of lines and lines that don't
# start with a letter.
if [[ -f ${SDC_CONFIG_FILENAME} ]]; then
eval $((cat ${SDC_CONFIG_FILENAME}; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | sed -e "s/^/${prefix}/")
eval $((cat ${SDC_CONFIG_FILENAME} ${SDC_CONFIG_INC_DIR}/generic; echo "config_inc_dir=${SDC_CONFIG_INC_DIR}") | \
sed -e "s/^ *//" | grep -v "^#" | grep "^[a-zA-Z]" | \
sed -e "s/^/${prefix}/")
elif [[ ${headnode} == "true" ]]; then
echo "FATAL: Unable to load headnode config."
exit 1
Expand Down
65 changes: 50 additions & 15 deletions overlay/lib/svc/manifest/system/smartdc-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@

<single_instance />

<!--
dependency/dependent info
We need to wait for fs-joyent to be done so we can access the USB key
We need to run before sysconfig so interactive configuration can talk
on the console
(sysconfig)
We don't want anything else running which spews on console
(system/identy)
We don't want manifest import scribbling on the console while running
(manifest-import)
-->
<dependency
name='filesystem-joyent'
type='service'
Expand All @@ -51,21 +62,45 @@
<service_fmri value='svc:/system/filesystem/smartdc' />
</dependency>

<!-- We don't want ssh starting if we haven't updated the passwords/keys -->
<dependent
name='ssh_multi-user-server'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/network/ssh' />
</dependent>

<!-- Make ntp wait so we can setup the config. -->
<dependent
name='ntp'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/network/ntp' />
</dependent>
<!--
We don't want ssh starting if we haven't updated the passwords/keys
-->
<dependent
name='ssh_multi-user-server'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/network/ssh' />
</dependent>

<!-- Make ntp wait so we can setup the config. -->
<dependent
name='ntp'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/network/ntp' />
</dependent>

<dependent
name='headnode_config'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/milestone/sysconfig' />
</dependent>

<dependent
name='identity'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/system/identity:node' />
</dependent>

<dependent
name='headnode_no_output'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/system/manifest-import' />
</dependent>


<exec_method
type='method'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@
<single_instance />

<!--
Ideally we would define the system/zones svc to be dependent on this
svc so that we run before system/zones. However, we cannot create
that dependency since the system/zones svc already exists in the
template repo and we'll get an error during early manifest import when
this svc is imported. Thus, we'll just use the zone autoboot logic
directly in our start method and have a dependency on the zones svc so
that there is no race condition booting the zones.
dependency info
This depends on the system/zones svc which seems weird since that
svc runs late in boot because it depends on milestone/multi-user-server.
Our svc does the initial setup of the infrastructure zones on the
headnode so we need the system/zones svc to run first so that we can
install and boot the infrastructure zones. The reason this seems
weird is that this svc also sets up the zpool when we first boot,
before we reboot to install the infrastructure zones, so it might seem
like it should run early in boot, but it can't because of the zone
issue described above.
-->
<dependency
name='zones'
Expand All @@ -64,14 +67,14 @@
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-joyinit %m'
exec='/lib/svc/method/smartdc-init %m'
timeout_seconds='0'>
</exec_method>

<exec_method
type='method'
name='stop'
exec='/lib/svc/method/svc-joyinit %m'
exec='/lib/svc/method/smartdc-init %m'
timeout_seconds='60'>
</exec_method>

Expand Down
File renamed without changes.

0 comments on commit 14a8e60

Please sign in to comment.