Skip to content

Commit

Permalink
testing -ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn Hurley committed Mar 14, 2019
1 parent 04a04a2 commit adddc8b
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions pkg/ansible/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@ func (r *AnsibleOperatorReconciler) Reconcile(request reconcile.Request) (reconc
}

func (r *AnsibleOperatorReconciler) markRunning(u *unstructured.Unstructured, namespacedName types.NamespacedName) error {
// Get the latest resource to prevent updating a stale status
err := r.Client.Get(context.TODO(), namespacedName, u)
if err != nil {
return err
}
statusInterface := u.Object["status"]
statusMap, _ := statusInterface.(map[string]interface{})
crStatus := ansiblestatus.CreateFromMap(statusMap)
Expand All @@ -258,26 +253,12 @@ func (r *AnsibleOperatorReconciler) markRunning(u *unstructured.Unstructured, na
)
ansiblestatus.SetCondition(&crStatus, *c)
u.Object["status"] = crStatus.GetJSONMap()
err = r.Client.Status().Update(context.TODO(), u)
if err != nil {
return err
}
return nil
return r.Client.Status().Update(context.TODO(), u)
}

// markError - used to alert the user to the issues during the validation of a reconcile run.
// i.e Annotations that could be incorrect
func (r *AnsibleOperatorReconciler) markError(u *unstructured.Unstructured, namespacedName types.NamespacedName, failureMessage string) error {
logger := logf.Log.WithName("markError")
// Get the latest resource to prevent updating a stale status
err := r.Client.Get(context.TODO(), namespacedName, u)
if apierrors.IsNotFound(err) {
logger.Info("Resource not found, assuming it was deleted", err)
return nil
}
if err != nil {
return err
}
statusInterface := u.Object["status"]
statusMap, ok := statusInterface.(map[string]interface{})
// If the map is not available create one.
Expand Down Expand Up @@ -307,16 +288,6 @@ func (r *AnsibleOperatorReconciler) markError(u *unstructured.Unstructured, name
}

func (r *AnsibleOperatorReconciler) markDone(u *unstructured.Unstructured, namespacedName types.NamespacedName, statusEvent eventapi.StatusJobEvent, failureMessages eventapi.FailureMessages) error {
logger := logf.Log.WithName("markDone")
// Get the latest resource to prevent updating a stale status
err := r.Client.Get(context.TODO(), namespacedName, u)
if apierrors.IsNotFound(err) {
logger.Info("Resource not found, assuming it was deleted")
return nil
}
if err != nil {
return err
}
statusInterface := u.Object["status"]
statusMap, _ := statusInterface.(map[string]interface{})
crStatus := ansiblestatus.CreateFromMap(statusMap)
Expand Down

0 comments on commit adddc8b

Please sign in to comment.