mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
chore: cleanup
This commit is contained in:
parent
4da1a2d1c1
commit
be8489a2fd
4 changed files with 7 additions and 9 deletions
|
|
@ -4156,8 +4156,8 @@ WHERE
|
|||
name IN (%s)
|
||||
`
|
||||
|
||||
var p strings.Builder
|
||||
var b []any
|
||||
var p strings.Builder
|
||||
for _, an := range assetNames {
|
||||
b = append(b, an)
|
||||
p.WriteString("?,")
|
||||
|
|
@ -4166,7 +4166,7 @@ WHERE
|
|||
stmt = fmt.Sprintf(stmt, strings.TrimSuffix(p.String(), ","))
|
||||
var res []fleet.MDMConfigAsset
|
||||
if err := sqlx.SelectContext(ctx, ds.reader(ctx), &res, stmt, b...); err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err, "checking asset existence")
|
||||
return nil, ctxerr.Wrap(ctx, err, "get mdm config assets by name")
|
||||
}
|
||||
|
||||
return res, nil
|
||||
|
|
|
|||
|
|
@ -689,6 +689,9 @@ type Service interface {
|
|||
GetAppleBM(ctx context.Context) (*AppleBM, error)
|
||||
RequestMDMAppleCSR(ctx context.Context, email, org string) (*AppleCSR, error)
|
||||
|
||||
// GetMDMAppleCSR returns a signed CSR as a base64 encoded string for Apple MDM. The first time
|
||||
// this method is called, it will create a SCEP certificate, a SCEP key, and an APNS key and
|
||||
// write these to the DB. On subsequent calls, it will use the saved APNS key for generating the CSR.
|
||||
GetMDMAppleCSR(ctx context.Context) (string, error)
|
||||
|
||||
// GetHostDEPAssignment retrieves the host DEP assignment for the specified host.
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ func GetSignedAPNSCSR(client *http.Client, csr *x509.CertificateRequest) error {
|
|||
}
|
||||
|
||||
// GetSignedAPNSCSRNoEmail makes a request to the fleetdm.com API to get a signed APNs
|
||||
// CSR and returns the signed CSR
|
||||
// CSR and returns the signed CSR.
|
||||
func GetSignedAPNSCSRNoEmail(client *http.Client, csr *x509.CertificateRequest) ([]byte, error) {
|
||||
csrPEM := EncodeCertRequestPEM(csr)
|
||||
|
||||
|
|
@ -179,11 +179,6 @@ func GetSignedAPNSCSRNoEmail(client *http.Client, csr *x509.CertificateRequest)
|
|||
return nil, FleetWebsiteError{Status: resp.StatusCode, message: string(respBytes)}
|
||||
}
|
||||
|
||||
// signedCSR, err := x509.ParseCertificateRequest(respBytes)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
|
||||
return respBytes, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -900,7 +900,7 @@ func (s *integrationMDMTestSuite) TestGetMDMCSR() {
|
|||
// Check that we return bad gateway if the website API errors
|
||||
s.FailNextCSRRequestWith(http.StatusInternalServerError)
|
||||
errResp := validationErrResp{}
|
||||
s.DoJSON("GET", "/api/latest/fleet/mdm/apple/request_csr", requestMDMAppleCSRRequest{EmailAddress: "a@b.c", Organization: "test"}, http.StatusBadGateway, &errResp)
|
||||
s.DoJSON("GET", "/api/latest/fleet/mdm/apple/request_csr", getMDMAppleCSRRequest{}, http.StatusBadGateway, &errResp)
|
||||
require.Len(t, errResp.Errors, 1)
|
||||
require.Contains(t, errResp.Errors[0].Reason, "FleetDM CSR request failed")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue