gitignore fix
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,7 +4,9 @@
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
*
|
||||
!*/
|
||||
!*.*
|
||||
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Generating..."
|
||||
|
||||
openssl genpkey -algorithm RSA -out ./hmac_key.pem -pkeyopt rsa_keygen_bits:4096
|
||||
|
||||
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -keyout api_key.pem -out api_cert.pem \
|
||||
-subj "/C=NL/ST=Noord-Holland/L=Amsterdam/O=ExOrg/OU=IT/CN=localhost"
|
||||
@@ -94,25 +94,29 @@ func RetrieveTokenNames() []string {
|
||||
}
|
||||
|
||||
func InsertTask(name, uuid, command string, nodeids []string, date string, expire time.Time) error {
|
||||
for _, singleNodeid := range nodeids {
|
||||
var count int
|
||||
err := db.QueryRow(declStat.CountDuplTasks, command, singleNodeid).Scan(&count)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to count the task occurence: %w", err)
|
||||
}
|
||||
log.Println(name, uuid, command, nodeids, date, expire)
|
||||
|
||||
if count > 0 {
|
||||
log.Println(WarnTag, "Skipped creation of a task because its a duplicate.")
|
||||
log.Println(WarnTag, fmt.Sprintf("Details: NodeID: %s, Task name: %s", singleNodeid, name))
|
||||
} else {
|
||||
formattedExpire := expire.Format(utilities.ExtLayout) // Safe format for DB
|
||||
|
||||
_, err = db.Exec(declStat.CreateTask, name, uuid, command, singleNodeid, date, formattedExpire)
|
||||
/*
|
||||
for _, singleNodeid := range nodeids {
|
||||
var count int
|
||||
err := db.QueryRow(declStat.CountDuplTasks, command, singleNodeid).Scan(&count)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create task: %w", err)
|
||||
return fmt.Errorf("failed to count the task occurence: %w", err)
|
||||
}
|
||||
|
||||
if count > 0 {
|
||||
log.Println(WarnTag, "Skipped creation of a task because its a duplicate.")
|
||||
log.Println(WarnTag, fmt.Sprintf("Details: NodeID: %s, Task name: %s", singleNodeid, name))
|
||||
} else {
|
||||
formattedExpire := expire.Format(utilities.ExtLayout) // Safe format for DB
|
||||
|
||||
_, err = db.Exec(declStat.CreateTask, name, uuid, command, singleNodeid, date, formattedExpire)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create task: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user