Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: github_repo does not apply defaults on existing repos #2386

Merged
merged 11 commits into from Nov 22, 2021
13 changes: 8 additions & 5 deletions plugins/modules/source_control/github/github_repo.py
Expand Up @@ -42,14 +42,16 @@
description:
description:
- Description for the repository.
- Defaults to empty when creating a new repository.
- Defaults to empty if force_defaults=true, which is the default in this module.
atorrescogollo marked this conversation as resolved.
Show resolved Hide resolved
- Defaults to empty if force_defaults=false when creating a new repository.
- This is only used when I(state) is C(present).
type: str
required: false
private:
description:
- Whether the repository should be private or not.
- Defaults to C(false) when creating a new repository.
- Defaults to C(false) if force_defaults=true, which is the default in this module.
- Defaults to C(false) if force_defaults=false when creating a new repository.
- This is only used when I(state) is C(present).
type: bool
required: false
Expand All @@ -74,10 +76,11 @@
version_added: "3.5.0"
force_defaults:
description:
- Overwrite current repository attributes with defaults if not set.
- Overwrite current description and private attributes with defaults if not set.
atorrescogollo marked this conversation as resolved.
Show resolved Hide resolved
type: bool
default: true
required: false
atorrescogollo marked this conversation as resolved.
Show resolved Hide resolved
version_added: 4.1.0
requirements:
- PyGithub>=1.54
notes:
Expand Down Expand Up @@ -206,8 +209,8 @@ def delete_repo(gh, name, organization=None, check_mode=False):

def run_module(params, check_mode=False):
if params['force_defaults']:
params['description'] = params.get('description') or ''
params['private'] = params.get('private') or False
params['description'] = params['description'] or ''
params['private'] = params['private'] or False

gh = authenticate(
username=params['username'], password=params['password'], access_token=params['access_token'],
Expand Down