mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-27 15:30:20 +08:00
Changed name to uid for WatchWorkflowExecution.
This commit is contained in:
committed by
rushtehrani
parent
2048b7a4eb
commit
c1ce0ad17b
@@ -646,25 +646,25 @@ func (c *Client) CountWorkflowExecutions(namespace, workflowTemplateUID, workflo
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) WatchWorkflowExecution(namespace, name string) (<-chan *WorkflowExecution, error) {
|
||||
_, err := c.GetWorkflowExecution(namespace, name)
|
||||
func (c *Client) WatchWorkflowExecution(namespace, uid string) (<-chan *WorkflowExecution, error) {
|
||||
_, err := c.GetWorkflowExecution(namespace, uid)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"Name": name,
|
||||
"UID": uid,
|
||||
"Error": err.Error(),
|
||||
}).Error("Workflow template not found.")
|
||||
return nil, util.NewUserError(codes.NotFound, "Workflow not found.")
|
||||
}
|
||||
|
||||
fieldSelector, _ := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", name))
|
||||
fieldSelector, _ := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", uid))
|
||||
watcher, err := c.ArgoprojV1alpha1().Workflows(namespace).Watch(metav1.ListOptions{
|
||||
FieldSelector: fieldSelector.String(),
|
||||
})
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"Name": name,
|
||||
"UID": uid,
|
||||
"Error": err.Error(),
|
||||
}).Error("Watch Workflow error.")
|
||||
return nil, util.NewUserError(codes.Unknown, "Error with watching workflow.")
|
||||
@@ -688,11 +688,11 @@ func (c *Client) WatchWorkflowExecution(namespace, name string) (<-chan *Workflo
|
||||
}
|
||||
|
||||
if workflow == nil && !ok {
|
||||
workflow, err = c.ArgoprojV1alpha1().Workflows(namespace).Get(name, metav1.GetOptions{})
|
||||
workflow, err = c.ArgoprojV1alpha1().Workflows(namespace).Get(uid, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"Name": name,
|
||||
"UID": uid,
|
||||
"Workflow": workflow,
|
||||
"Error": err.Error(),
|
||||
}).Error("Unable to get workflow.")
|
||||
@@ -709,7 +709,7 @@ func (c *Client) WatchWorkflowExecution(namespace, name string) (<-chan *Workflo
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"Name": name,
|
||||
"UID": uid,
|
||||
"Workflow": workflow,
|
||||
"Error": err.Error(),
|
||||
}).Error("Error with trying to JSON Marshal workflow.Status.")
|
||||
|
||||
Reference in New Issue
Block a user