Bugfixes found Shuffle blog part 2

This commit is contained in:
frikky
2020-05-26 18:10:23 +02:00
parent 5815dbe5ed
commit 8ab60dd30a
7 changed files with 21 additions and 10 deletions
+1
View File
@@ -588,6 +588,7 @@ class AppBase:
logging.basicConfig(format="{asctime} - {name} - {levelname}:{message}", style='{') logging.basicConfig(format="{asctime} - {name} - {levelname}:{message}", style='{')
logger = logging.getLogger(f"{cls.__name__}") logger = logging.getLogger(f"{cls.__name__}")
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
print("Started execution!!")
app = cls(redis=None, logger=logger, console_logger=logger) app = cls(redis=None, logger=logger, console_logger=logger)
+1
View File
@@ -637,6 +637,7 @@ func getRunner(classname string) string {
return fmt.Sprintf(` return fmt.Sprintf(`
# Run the actual thing after we've checked params # Run the actual thing after we've checked params
def run(request): def run(request):
print("Started execution!")
action = request.get_json() action = request.get_json()
print(action) print(action)
print(type(action)) print(type(action))
+1 -1
View File
@@ -5748,10 +5748,10 @@ func runInit(ctx context.Context) {
} }
} }
//log.Printf("Schedule time: every %d seconds", schedule.Seconds)
jobret, err := newscheduler.Every(schedule.Seconds).Seconds().NotImmediately().Run(job) jobret, err := newscheduler.Every(schedule.Seconds).Seconds().NotImmediately().Run(job)
if err != nil { if err != nil {
log.Printf("Failed to schedule workflow: %s", err) log.Printf("Failed to schedule workflow: %s", err)
// FIXME: what now? lol:w
} }
scheduledJobs[schedule.Id] = jobret scheduledJobs[schedule.Id] = jobret
+12 -3
View File
@@ -2340,7 +2340,16 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
return return
} }
log.Printf("Schedulearg: %s", string(scheduleArg)) // Clean up garbage. This might be wrong in some very specific use-cases
parsedBody := string(scheduleArg)
parsedBody = strings.Replace(parsedBody, "\\\"", "\"", -1)
if len(parsedBody) > 0 {
if string(parsedBody[0]) == `"` && string(parsedBody[len(parsedBody)-1]) == "\"" {
parsedBody = parsedBody[1 : len(parsedBody)-1]
}
}
log.Printf("Schedulearg: %s", parsedBody)
err = createSchedule( err = createSchedule(
ctx, ctx,
@@ -2348,7 +2357,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
workflow.ID, workflow.ID,
schedule.Name, schedule.Name,
schedule.Frequency, schedule.Frequency,
scheduleArg, []byte(parsedBody),
) )
// FIXME - real error message lol // FIXME - real error message lol
@@ -3325,7 +3334,6 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
// Check the file // Check the file
filename := file.Name() filename := file.Name()
if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") { if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") {
appCounter += 1
//log.Printf("File: %s", filename) //log.Printf("File: %s", filename)
//log.Printf("Found file: %s", filename) //log.Printf("Found file: %s", filename)
tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name()) tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name())
@@ -3395,6 +3403,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
log.Printf("Failed setting workflowapp in loop: %s", err) log.Printf("Failed setting workflowapp in loop: %s", err)
continue continue
} else { } else {
appCounter += 1
log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion) log.Printf("Added %s:%s to the database from OpenAPI repo", api.Name, api.AppVersion)
// Set OpenAPI datastore // Set OpenAPI datastore
+2 -2
View File
@@ -4118,7 +4118,7 @@ const AngularWorkflow = (props) => {
<div style={{marginTop: "20px", marginBottom: "7px", display: "flex"}}> <div style={{marginTop: "20px", marginBottom: "7px", display: "flex"}}>
<div style={{width: "17px", height: "17px", borderRadius: 17 / 2, backgroundColor: "#f85a3e", marginRight: "10px"}}/> <div style={{width: "17px", height: "17px", borderRadius: 17 / 2, backgroundColor: "#f85a3e", marginRight: "10px"}}/>
<div style={{flex: "10"}}> <div style={{flex: "10"}}>
<b>Run how often (seconds)? </b> <b>Interval (seconds) </b>
</div> </div>
</div> </div>
<TextField <TextField
@@ -4489,7 +4489,7 @@ const AngularWorkflow = (props) => {
<h2>Executing Workflow</h2> <h2>Executing Workflow</h2>
{executionData.execution_argument !== undefined && executionData.execution_argument.length > 0 ? {executionData.execution_argument !== undefined && executionData.execution_argument.length > 0 ?
<div> <div>
<h3>Execution Argument: </h3>{executionText} <h3>Execution Argument: </h3>{executionData.execution_argument}
</div> </div>
: null } : null }
{executionData.status !== undefined && executionData.status.length > 0 ? {executionData.status !== undefined && executionData.status.length > 0 ?
+1 -1
View File
@@ -600,7 +600,7 @@ const AppCreator = (props) => {
console.log("Location: ", parameterLocation) console.log("Location: ", parameterLocation)
console.log("Name: ", parameterName) console.log("Name: ", parameterName)
const apiKey = authenticationOption === "API key" ? const apiKey = authenticationOption === "API key" ?
<div> <div style={{color: "white"}}>
<h4>API key</h4> <h4>API key</h4>
<TextField <TextField
required required
+3 -3
View File
@@ -886,15 +886,15 @@ const Workflows = (props) => {
<div style={emptyWorkflowStyle}> <div style={emptyWorkflowStyle}>
<Paper style={boxStyle}> <Paper style={boxStyle}>
<div> <div>
<h2>Welcome to Shuffle!</h2> <h2>Welcome to Shuffle</h2>
</div> </div>
<div> <div>
<p> <p>
<b>Shuffle</b> is a flexible, easy to use, automation framework allowing users to integrate their services and devices to reduce the amount of manual labor required for those tasks. <Link to="/docs/workflows" style={{textDecoration: "none", color: "#f85a3e"}}>Click here for more information.</Link> <b>Shuffle</b> is a flexible, easy to use, automation platform allowing users to integrate their services and devices freely. It's made to significantly reduce the amount of manual labor, and is focused on security applications. <Link to="/docs/about" style={{textDecoration: "none", color: "#f85a3e"}}>Click here to learn more.</Link>
</p> </p>
</div> </div>
<div> <div>
If you want to jump straight into it, click the following button to create your first workflow: If you want to jump straight into it, click here to create your first workflow:
</div> </div>
<div> <div>
<Button color="primary" style={{marginTop: "20px",}} variant="outlined" onClick={() => setModalOpen(true)}>New workflow</Button> <Button color="primary" style={{marginTop: "20px",}} variant="outlined" onClick={() => setModalOpen(true)}>New workflow</Button>