Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
e51b1c5c
Commit
e51b1c5c
authored
Jul 09, 2013
by
Dan Reading
Browse files
add function to check to for inventory driff
parent
88a199fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/common/checknode/checkinventorydrift
0 → 120000
View file @
e51b1c5c
gen_sql
\ No newline at end of file
clientside/tmcc/common/checknode/gen_sql
View file @
e51b1c5c
...
...
@@ -3,6 +3,47 @@
source
checkutils.sh
checkdrift_main
()
{
set
-u
projdir
=
/proj/emulab-ops/nodecheck
cd
$projdir
if
((
$#
))
;
then
allnodes
=
"
$@
"
else
allnodes
=
$(
ls
-d
pc
*
pg
*
dbox
*
)
fi
for
host
in
$allnodes
;
do
if
[
-d
$projdir
/
$host
/.tbdb
]
;
then
cd
$projdir
/
$host
/.tbdb
newest
=
$(
ls
-t
|
head
-1
)
allchecks
=
$(
ls
-t
)
readtmcinfo
$newest
hwinvcopy
declare
-i
countsame
=
-1
for
tocheck
in
$allchecks
;
do
readtmcinfo
$tocheck
hwinv
# note: will check against self for sanity
comparetmcinfo /tmp/.
$$
checkdiff
if
[
-s
/tmp/.
$$
checkdiff
]
;
then
echo
"
$host
$newest
$tocheck
are not the same"
# XXX - start
# XXX Do not enable this code unless you want
# the files moved out of the way
# [[ ! -d $projdir/$host/.tbdb/.notsame ]] && sudo mkdir -p $projdir/$host/.tbdb/.notsame
# sudo mv $tocheck $projdir/$host/.tbdb/.notsame
# XXX - end
else
# echo "$host $newest $tocheck SAME"
((
countsame++
))
fi
rm
-f
/tmp/.
$$
checkdiff
done
echo
"
$host
$countsame
inventory files are the same"
else
echo
"No record of node id
\"
$host
\"
."
fi
done
}
gentbsql_main
()
{
set
-u
projdir
=
/proj/emulab-ops/nodecheck
...
...
@@ -122,10 +163,14 @@ setdirstructure() {
}
if
[
"
$0
"
=
"
${
0
/s
ql
}
"
]
;
then
if
[
"
$0
"
!
=
"
${
0
/s
etdir
}
"
]
;
then
setdirstructure
el
se
el
if
[
"
$0
"
!=
"
${
0
/sql
}
"
]
;
then
gentbsql_main
$@
elif
[
"
$0
"
!=
"
${
0
/drift
}
"
]
;
then
checkdrift_main
$@
else
"Print useage help"
fi
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment