use proper resource ids in factory (#3912)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🐛 Bugfix #### Test Plan - [x] 💚 E2E
This commit is contained in:
parent
3613cb2aa0
commit
0c25c568c1
3
.github/actions/slack-message/action.yml
vendored
3
.github/actions/slack-message/action.yml
vendored
@ -31,6 +31,7 @@ runs:
|
|||||||
- name: use url or blank val
|
- name: use url or blank val
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
echo "STEP=${{ github.action || '' }}" >> $GITHUB_ENV
|
||||||
echo "JOB=${{ github.job || '' }}" >> $GITHUB_ENV
|
echo "JOB=${{ github.job || '' }}" >> $GITHUB_ENV
|
||||||
echo "LOGS=${{ github.run_id && env.logurl || '-' }}" >> $GITHUB_ENV
|
echo "LOGS=${{ github.run_id && env.logurl || '-' }}" >> $GITHUB_ENV
|
||||||
echo "COMMIT=${{ github.sha && env.commiturl || '-' }}" >> $GITHUB_ENV
|
echo "COMMIT=${{ github.sha && env.commiturl || '-' }}" >> $GITHUB_ENV
|
||||||
@ -50,7 +51,7 @@ runs:
|
|||||||
"type": "section",
|
"type": "section",
|
||||||
"text": {
|
"text": {
|
||||||
"type": "mrkdwn",
|
"type": "mrkdwn",
|
||||||
"text": "${{ inputs.msg }} :: ${{ env.JOB }}\n${{ env.LOGS }} ${{ env.COMMIT }} ${{ env.REF }}"
|
"text": "${{ inputs.msg }} :: ${{ env.JOB }} - ${{ env.STEP }}\n${{ env.LOGS }} ${{ env.COMMIT }} ${{ env.REF }}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -224,7 +224,8 @@ var (
|
|||||||
|
|
||||||
func generateAndRestoreDriveItems(
|
func generateAndRestoreDriveItems(
|
||||||
ctrl *m365.Controller,
|
ctrl *m365.Controller,
|
||||||
resourceOwner, secondaryUserID, secondaryUserName string,
|
protectedResource idname.Provider,
|
||||||
|
secondaryUserID, secondaryUserName string,
|
||||||
acct account.Account,
|
acct account.Account,
|
||||||
service path.ServiceType,
|
service path.ServiceType,
|
||||||
cat path.CategoryType,
|
cat path.CategoryType,
|
||||||
@ -248,14 +249,23 @@ func generateAndRestoreDriveItems(
|
|||||||
|
|
||||||
switch service {
|
switch service {
|
||||||
case path.SharePointService:
|
case path.SharePointService:
|
||||||
d, err := ctrl.AC.Stable.Client().Sites().BySiteId(resourceOwner).Drive().Get(ctx, nil)
|
d, err := ctrl.AC.Stable.
|
||||||
|
Client().
|
||||||
|
Sites().
|
||||||
|
BySiteId(protectedResource.ID()).
|
||||||
|
Drive().
|
||||||
|
Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "getting site's default drive")
|
return nil, clues.Wrap(err, "getting site's default drive")
|
||||||
}
|
}
|
||||||
|
|
||||||
driveID = ptr.Val(d.GetId())
|
driveID = ptr.Val(d.GetId())
|
||||||
default:
|
default:
|
||||||
d, err := ctrl.AC.Stable.Client().Users().ByUserId(resourceOwner).Drive().Get(ctx, nil)
|
d, err := ctrl.AC.Stable.Client().
|
||||||
|
Users().
|
||||||
|
ByUserId(protectedResource.ID()).
|
||||||
|
Drive().
|
||||||
|
Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, clues.Wrap(err, "getting user's default drive")
|
return nil, clues.Wrap(err, "getting user's default drive")
|
||||||
}
|
}
|
||||||
@ -423,7 +433,7 @@ func generateAndRestoreDriveItems(
|
|||||||
Resource: resource.Users,
|
Resource: resource.Users,
|
||||||
Service: service,
|
Service: service,
|
||||||
Tenant: tenantID,
|
Tenant: tenantID,
|
||||||
ResourceOwners: []string{resourceOwner},
|
ResourceOwners: []string{protectedResource.ID()},
|
||||||
RestoreCfg: restoreCfg,
|
RestoreCfg: restoreCfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +448,7 @@ func generateAndRestoreDriveItems(
|
|||||||
rcc := inject.RestoreConsumerConfig{
|
rcc := inject.RestoreConsumerConfig{
|
||||||
BackupVersion: version.Backup,
|
BackupVersion: version.Backup,
|
||||||
Options: opts,
|
Options: opts,
|
||||||
ProtectedResource: sel,
|
ProtectedResource: protectedResource,
|
||||||
RestoreConfig: restoreCfg,
|
RestoreConfig: restoreCfg,
|
||||||
Selector: sel,
|
Selector: sel,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ func handleOneDriveFileFactory(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
deets, err := generateAndRestoreDriveItems(
|
deets, err := generateAndRestoreDriveItems(
|
||||||
ctrl,
|
ctrl,
|
||||||
inp.ID(),
|
inp,
|
||||||
SecondaryUser,
|
SecondaryUser,
|
||||||
strings.ToLower(SecondaryUser),
|
strings.ToLower(SecondaryUser),
|
||||||
acct,
|
acct,
|
||||||
|
|||||||
@ -47,7 +47,7 @@ func handleSharePointLibraryFileFactory(cmd *cobra.Command, args []string) error
|
|||||||
|
|
||||||
deets, err := generateAndRestoreDriveItems(
|
deets, err := generateAndRestoreDriveItems(
|
||||||
ctrl,
|
ctrl,
|
||||||
inp.ID(),
|
inp,
|
||||||
SecondaryUser,
|
SecondaryUser,
|
||||||
strings.ToLower(SecondaryUser),
|
strings.ToLower(SecondaryUser),
|
||||||
acct,
|
acct,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user