Skip to content

Commit 1ecb090

Browse files
author
Ian Oliver
committed
fixed annoying machine id comparision issue in the sys rules...it was tarzans fault
1 parent 1979d86 commit 1ecb090

File tree

20 files changed

+11
-5929
lines changed

20 files changed

+11
-5929
lines changed

janeserver/rules/sysrules/public.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ func Callrulesafe(claim structures.Claim, rule string, ev structures.ExpectedVal
3131

3232
func CallrulemachineIDTA(claim structures.Claim, rule string, ev structures.ExpectedValue, session structures.Session, parameter map[string]interface{}) (structures.ResultValue, string, error) {
3333

34+
// NB: there's a lot of trimming of strings going on here, this is because we want to drop any newline etc
35+
// characters, just in case. Tarzan however does now strip these, but done here as an addition precaution
36+
// because reading /etc/machineid as tarzan does introduce these characters, even though they are not
37+
// present in the original file.
38+
3439
machineid, ok := claim.Body["machineid"]
3540
if !ok {
3641
return structures.RuleCallFailure, "TA not of correct type, or not reporting machineid parameter value", nil
3742
}
38-
3943
claimedMachineID := strings.Trim(fmt.Sprintf("%v", machineid), " \t\n")
4044

41-
// We get this from the EXPECTED VALUES
42-
expectedMachineID := (ev.EVS)["machineid"]
43-
44-
fmt.Printf("Comparison\n%v\n%v\n%v\n===\n", claimedMachineID, expectedMachineID, claimedMachineID == expectedMachineID)
45+
emachineid := ((ev.EVS)["machineid"]).(string)
46+
expectedMachineID := strings.Trim(fmt.Sprintf("%v", emachineid), " \t\n")
4547

4648
// and now the check
4749
if expectedMachineID == claimedMachineID {

provisioner/_yaml/__init__.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)