mirror of
https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git
synced 2024-12-04 21:08:11 +00:00
Merge pull request #38 from Lerentis/Lerentis/issue35
potential fix for #35
This commit is contained in:
commit
b3f93373d0
2 changed files with 12 additions and 7 deletions
|
@ -41,7 +41,7 @@ func resourceTeamRead(d *schema.ResourceData, meta interface{}) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = setTeamResourceData(team, d)
|
err = setTeamResourceData(team, d, meta)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func resourceTeamCreate(d *schema.ResourceData, meta interface{}) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = setTeamResourceData(team, d)
|
err = setTeamResourceData(team, d, meta)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ func resourceTeamUpdate(d *schema.ResourceData, meta interface{}) (err error) {
|
||||||
|
|
||||||
team, _, _ = client.GetTeam(id)
|
team, _, _ = client.GetTeam(id)
|
||||||
|
|
||||||
err = setTeamResourceData(team, d)
|
err = setTeamResourceData(team, d, meta)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,13 @@ func resourceTeamDelete(d *schema.ResourceData, meta interface{}) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func setTeamResourceData(team *gitea.Team, d *schema.ResourceData) (err error) {
|
func setTeamResourceData(team *gitea.Team, d *schema.ResourceData, meta interface{}) (err error) {
|
||||||
|
client := meta.(*gitea.Client)
|
||||||
|
if err := client.CheckServerVersionConstraint(">= 1.19.4"); err != nil {
|
||||||
|
d.Set(TeamOrg, d.Get(TeamOrg).(string))
|
||||||
|
} else {
|
||||||
|
d.Set(TeamOrg, team.Organization.UserName)
|
||||||
|
}
|
||||||
d.SetId(fmt.Sprintf("%d", team.ID))
|
d.SetId(fmt.Sprintf("%d", team.ID))
|
||||||
d.Set(TeamCreateRepoFlag, team.CanCreateOrgRepo)
|
d.Set(TeamCreateRepoFlag, team.CanCreateOrgRepo)
|
||||||
d.Set(TeamDescription, team.Description)
|
d.Set(TeamDescription, team.Description)
|
||||||
|
@ -234,7 +240,6 @@ func setTeamResourceData(team *gitea.Team, d *schema.ResourceData) (err error) {
|
||||||
d.Set(TeamPermissions, string(team.Permission))
|
d.Set(TeamPermissions, string(team.Permission))
|
||||||
d.Set(TeamIncludeAllReposFlag, team.IncludesAllRepositories)
|
d.Set(TeamIncludeAllReposFlag, team.IncludesAllRepositories)
|
||||||
d.Set(TeamUnits, d.Get(TeamUnits).(string))
|
d.Set(TeamUnits, d.Get(TeamUnits).(string))
|
||||||
d.Set(TeamOrg, d.Get(TeamOrg).(string))
|
|
||||||
d.Set(TeamMembers, d.Get(TeamMembers))
|
d.Set(TeamMembers, d.Get(TeamMembers))
|
||||||
d.Set(TeamRepositories, d.Get(TeamRepositories))
|
d.Set(TeamRepositories, d.Get(TeamRepositories))
|
||||||
return
|
return
|
||||||
|
@ -247,7 +252,7 @@ func resourceGiteaTeam() *schema.Resource {
|
||||||
Update: resourceTeamUpdate,
|
Update: resourceTeamUpdate,
|
||||||
Delete: resourceTeamDelete,
|
Delete: resourceTeamDelete,
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
State: schema.ImportStatePassthrough,
|
StateContext: schema.ImportStatePassthroughContext,
|
||||||
},
|
},
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": {
|
"name": {
|
||||||
|
|
|
@ -6,7 +6,7 @@ networks:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
server:
|
server:
|
||||||
image: gitea/gitea:1.17.1
|
image: gitea/gitea:1.19.3
|
||||||
container_name: gitea
|
container_name: gitea
|
||||||
environment:
|
environment:
|
||||||
- USER_UID=1000
|
- USER_UID=1000
|
||||||
|
|
Loading…
Reference in a new issue