(ctx context.Context)
| 88 | } |
| 89 | |
| 90 | func slaveTaskPropsFromContext(ctx context.Context) (*types.SlaveTaskProps, error) { |
| 91 | nodeIdStr, ok := ctx.Value(cluster.SlaveNodeIDCtx{}).(string) |
| 92 | if !ok { |
| 93 | return nil, fmt.Errorf("failed to get node ID from context") |
| 94 | } |
| 95 | |
| 96 | nodeId, err := strconv.Atoi(nodeIdStr) |
| 97 | if err != nil { |
| 98 | return nil, fmt.Errorf("failed to convert node ID to int: %w", err) |
| 99 | } |
| 100 | |
| 101 | masterSiteUrl := cluster.MasterSiteUrlFromContext(ctx) |
| 102 | if masterSiteUrl == "" { |
| 103 | return nil, fmt.Errorf("failed to get master site URL from context") |
| 104 | } |
| 105 | |
| 106 | masterSiteVersion, ok := ctx.Value(cluster.MasterSiteVersionCtx{}).(string) |
| 107 | if !ok { |
| 108 | return nil, fmt.Errorf("failed to get master site version from context") |
| 109 | } |
| 110 | |
| 111 | masterSiteId, ok := ctx.Value(cluster.MasterSiteIDCtx{}).(string) |
| 112 | if !ok { |
| 113 | return nil, fmt.Errorf("failed to convert master site ID to int: %w", err) |
| 114 | } |
| 115 | |
| 116 | props := &types.SlaveTaskProps{ |
| 117 | NodeID: nodeId, |
| 118 | MasterSiteID: masterSiteId, |
| 119 | MasterSiteURl: masterSiteUrl, |
| 120 | MasterSiteVersion: masterSiteVersion, |
| 121 | } |
| 122 | |
| 123 | return props, nil |
| 124 | } |
| 125 | |
| 126 | type ( |
| 127 | FolderCleanupParamCtx struct{} |
no test coverage detected