Skip to content

Commit af3ef28

Browse files
fix: fixing read functionality
Signed-off-by: Bram Vogelaar <[email protected]>
1 parent 0b519ef commit af3ef28

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

cmd/read.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ var listCmd = &cobra.Command{
3636
fqdn := args[0]
3737
otp_token, err := client.Read(fqdn)
3838
if err != nil {
39-
t.AppendRow([]interface{}{otp_token.Fqdn, time.Unix(otp_token.Expire_at_unix, 0).Format(time.Kitchen), otp_token.Otp_token})
40-
t.Render()
41-
} else {
4239
log.Fatalf("unable to find otp token for %s", fqdn)
40+
} else {
41+
t.AppendRow([]interface{}{otp_token.Fqdn, time.Unix(otp_token.Expire_at_unix, 0).Format(time.Kitchen), otp_token.Token_table_item})
42+
t.Render()
4343
}
4444
} else {
4545
tokens := client.ReadAll()
4646
if len(tokens) > 0 {
4747
for _, record := range tokens {
48-
t.AppendRow([]interface{}{record.Fqdn, time.Unix(record.Expire_at_unix, 0).Format(time.Kitchen), record.Otp_token})
48+
t.AppendRow([]interface{}{record.Fqdn, time.Unix(record.Expire_at_unix, 0).Format(time.Kitchen), record.Token_table_item})
4949
}
5050
t.Render()
5151
} else {

cmd/validate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var validateCsrCmd = &cobra.Command{
4646
log.Fatalf("unable to find otp token for %s", fqdn)
4747
}
4848

49-
if otp.Otp_token == csrCP {
49+
if otp.Token_table_item == csrCP {
5050
fmt.Println("Found otp for " + fqdn + "")
5151
} else {
5252
log.Fatalf("Unable to match otp token for %s", fqdn)

internal/aws/dynamodb.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
var TableName = "puppet-dynamodb-otp"
1515

1616
type Otp_token struct {
17-
Expire_at_unix int64
18-
Fqdn string
19-
Otp_token string
17+
Expire_at_unix int64
18+
Fqdn string
19+
Token_table_item string
2020
}
2121

2222
func (svc *Client) Create(expire_at_unix int64, fqdn string, otp_token string) {

0 commit comments

Comments
 (0)