Skip to content

Commit c11b885

Browse files
1.5.2
Changelog: * Fix openapi tests. * Fix bug with several enum fields in .polemarch.yaml form. See merge request polemarch/ce!174
2 parents 8b5400b + 88bfc33 commit c11b885

File tree

14 files changed

+66
-2346
lines changed

14 files changed

+66
-2346
lines changed

.gitlab-ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ py37-coverage:
8686
<<: *branch_tests
8787
variables:
8888
TOX_ENVS: "$CI_BUILD_NAME"
89-
allow_failure: true
9089

9190
py36-install:
9291
<<: *branch_tests
@@ -184,23 +183,24 @@ release_pypi:
184183
TOX_ARGS: ""
185184
script:
186185
- make test ENVS=build
186+
- make twine
187187
allow_failure: true
188188
artifacts:
189-
name: "release-rpm-${CI_BUILD_REF_NAME}.${CI_BUILD_ID}"
189+
name: "release-packages-${CI_BUILD_REF_NAME}.${CI_BUILD_ID}"
190190
paths:
191191
- dist/
192192

193-
publish_pypi:
194-
stage: publish
195-
image: onegreyonewhite/tox:tox
196-
only:
197-
refs:
198-
- tags
199-
variables:
200-
- $PYPI_UPLOAD_PASSWORD
201-
- $PYPI_UPLOAD_NAME
202-
script:
203-
- make twine
193+
#publish_pypi:
194+
# stage: publish
195+
# image: onegreyonewhite/tox:tox
196+
# only:
197+
# refs:
198+
# - tags
199+
# variables:
200+
# - $PYPI_UPLOAD_PASSWORD
201+
# - $PYPI_UPLOAD_NAME
202+
# script:
203+
# - make twine
204204

205205

206206
publish_release:

doc/api_schema.yaml

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ info:
1919
url: https://gitlab.com/vstconsulting/polemarch.git
2020
Request:
2121
- name: Question
22-
url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%201.4.4
22+
url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%201.5.2
2323
- name: Bug report
24-
url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%201.4.4
24+
url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%201.5.2
2525
- name: Feature request
2626
url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Feature%20request&issue%5Btitle%5D=
2727
x-menu:
@@ -54,11 +54,11 @@ info:
5454
span_class: fa fa-plug
5555
url: /hook
5656
x-versions:
57-
application: 1.4.4
58-
library: 1.4.4
59-
vstutils: 2.6.6
60-
django: 2.2.4
61-
ansible: 2.8.4
57+
application: 1.5.2
58+
library: 1.5.2
59+
vstutils: 2.11.2
60+
django: 2.2.7
61+
ansible: 2.8.7
6262
version: v2
6363
host: localhost:8080
6464
schemes:
@@ -8060,6 +8060,11 @@ paths:
80608060
description: Full path to module.
80618061
required: false
80628062
type: string
8063+
- name: name
8064+
in: query
8065+
description: Name of module.
8066+
required: false
8067+
type: string
80638068
- name: path__not
80648069
in: query
80658070
description: Full path to module.
@@ -8763,6 +8768,11 @@ paths:
87638768
description: Playbook filename.
87648769
required: false
87658770
type: string
8771+
- name: pb_filter
8772+
in: query
8773+
description: Playbook filename - filter for prefetch.
8774+
required: false
8775+
type: string
87668776
- name: id__not
87678777
in: query
87688778
description: A unique integer value (or comma separated list) identifying
@@ -11426,9 +11436,8 @@ definitions:
1142611436
default: false
1142711437
become_method:
1142811438
title: Become method
11429-
description: 'privilege escalation method to use (default=sudo), valid choices:
11430-
[ sudo | su | pbrun | pfexec | doas | dzdo | ksu | runas | pmrun | enable
11431-
| machinectl ]'
11439+
description: privilege escalation method to use (default=%default), use `ansible-doc
11440+
-t become -l` to list valid choices.
1143211441
type: string
1143311442
become_user:
1143411443
title: Become user
@@ -11486,8 +11495,7 @@ definitions:
1148611495
default: false
1148711496
module_path:
1148811497
title: Module path
11489-
description: prepend colon-separated path(s) to module library (default=[u'/home/grey/.ansible/plugins/modules',
11490-
u'/usr/share/ansible/plugins/modules'])
11498+
description: prepend colon-separated path(s) to module library (default=~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules)
1149111499
type: string
1149211500
one_line:
1149311501
title: One line
@@ -11496,7 +11504,7 @@ definitions:
1149611504
default: false
1149711505
playbook_dir:
1149811506
title: Playbook dir
11499-
description: Since this tool does not use playbooks, use this as a subsitute
11507+
description: Since this tool does not use playbooks, use this as a substitute
1150011508
playbook directory.This sets the relative path for many features including
1150111509
roles/ group_vars/ etc.
1150211510
type: string
@@ -11525,25 +11533,6 @@ definitions:
1152511533
title: Ssh extra args
1152611534
description: specify extra arguments to pass to ssh only (e.g. -R)
1152711535
type: string
11528-
su:
11529-
title: Su
11530-
description: run operations with su (deprecated, use become)
11531-
type: boolean
11532-
default: false
11533-
su_user:
11534-
title: Su user
11535-
description: run operations with su as this user (default=None) (deprecated,
11536-
use become)
11537-
type: string
11538-
sudo:
11539-
title: Sudo
11540-
description: run operations with sudo (nopasswd) (deprecated, use become)
11541-
type: boolean
11542-
default: false
11543-
sudo_user:
11544-
title: Sudo user
11545-
description: desired sudo user (default=root) (deprecated, use become)
11546-
type: string
1154711536
syntax_check:
1154811537
title: Syntax check
1154911538
description: perform a syntax check on the playbook, but do not execute it
@@ -11620,9 +11609,8 @@ definitions:
1162011609
default: false
1162111610
become_method:
1162211611
title: Become method
11623-
description: 'privilege escalation method to use (default=sudo), valid choices:
11624-
[ sudo | su | pbrun | pfexec | doas | dzdo | ksu | runas | pmrun | enable
11625-
| machinectl ]'
11612+
description: privilege escalation method to use (default=%default), use `ansible-doc
11613+
-t become -l` to list valid choices.
1162611614
type: string
1162711615
become_user:
1162811616
title: Become user
@@ -11700,8 +11688,7 @@ definitions:
1170011688
default: false
1170111689
module_path:
1170211690
title: Module path
11703-
description: prepend colon-separated path(s) to module library (default=[u'/home/grey/.ansible/plugins/modules',
11704-
u'/usr/share/ansible/plugins/modules'])
11691+
description: prepend colon-separated path(s) to module library (default=~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules)
1170511692
type: string
1170611693
private_key:
1170711694
title: Private key
@@ -11737,25 +11724,6 @@ definitions:
1173711724
description: 'one-step-at-a-time: confirm each task before running'
1173811725
type: boolean
1173911726
default: false
11740-
su:
11741-
title: Su
11742-
description: run operations with su (deprecated, use become)
11743-
type: boolean
11744-
default: false
11745-
su_user:
11746-
title: Su user
11747-
description: run operations with su as this user (default=None) (deprecated,
11748-
use become)
11749-
type: string
11750-
sudo:
11751-
title: Sudo
11752-
description: run operations with sudo (nopasswd) (deprecated, use become)
11753-
type: boolean
11754-
default: false
11755-
sudo_user:
11756-
title: Sudo user
11757-
description: desired sudo user (default=root) (deprecated, use become)
11758-
type: string
1175911727
syntax_check:
1176011728
title: Syntax check
1176111729
description: perform a syntax check on the playbook, but do not execute it

polemarch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
"VST_ROOT_URLCONF": os.getenv("VST_ROOT_URLCONF", 'vstutils.urls'),
3232
}
3333

34-
__version__ = "1.5.1"
34+
__version__ = "1.5.2"
3535

3636
prepare_environment(**default_settings)

polemarch/main/models/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .vars import Variable
1818
from .hosts import Host, Group, Inventory
1919
from .projects import Project, Task, Module, ProjectTemplate, list_to_choices
20-
from .users import BaseUser, UserGroup, ACLPermission, UserSettings
20+
from .users import get_user_model, UserGroup, ACLPermission, UserSettings
2121
from .tasks import PeriodicTask, History, HistoryLines, Template
2222
from .hooks import Hook
2323
from ..validators import RegexValidator, validate_hostname
@@ -26,6 +26,7 @@
2626

2727

2828
logger = logging.getLogger('polemarch')
29+
BaseUser = get_user_model()
2930

3031

3132
#####################################

polemarch/main/models/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from typing import Callable, Any
44
from django.db import models
55
from django.conf import settings
6-
from django.contrib.auth.models import User as BaseUser
6+
from django.contrib.auth import get_user_model
77
from django.utils.module_loading import import_string
88
from vstutils.utils import classproperty
99
from vstutils.models import BQuerySet as _BQSet, BaseModel as _BM, Manager as _BManager
1010

1111

1212
def first_staff_user() -> int:
13-
return BaseUser.objects.filter(is_staff=True).first().id
13+
return get_user_model().objects.filter(is_staff=True).first().id
1414

1515

1616
class BQuerySet(_BQSet):

polemarch/main/models/tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from django.db import transaction
1515
from django.db.models import Q
1616
from django.utils import timezone
17-
from django.contrib.auth.models import User
17+
from django.contrib.auth import get_user_model
1818
from django.db.models import functions as dbfunc, Count
1919
from django.utils.timezone import now
2020
from django.test import Client
@@ -30,6 +30,7 @@
3030

3131
logger = logging.getLogger("polemarch")
3232
InvOrString = TypeVar('InvOrString', str, int, Inventory, None)
33+
User = get_user_model()
3334

3435

3536
# Block of real models

polemarch/main/models/users.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import json
66

77
from django.contrib.auth.models import Group as BaseGroup
8-
from django.contrib.auth.models import User as BaseUser
98
from django.contrib.auth import get_user_model
109
from .base import models, BModel, ACLModel, BQuerySet
1110

@@ -50,7 +49,7 @@ class UserGroup(BaseGroup, ACLModel):
5049

5150
class UserSettings(BModel):
5251
settings = models.TextField(default="{}")
53-
user = models.OneToOneField(BaseUser, on_delete=models.CASCADE,
52+
user = models.OneToOneField(get_user_model(), on_delete=models.CASCADE,
5453
related_query_name="settings",
5554
related_name="settings")
5655

polemarch/main/models/vars.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class Meta:
110110
'ansible_ssh_pass',
111111
'ansible_ssh_private_key_file',
112112
'ansible_become_pass',
113+
'ansible_become_password',
113114
'ansible_password'
114115
]
115116

polemarch/main/tests/api.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
from django.test import Client
44
from django.contrib.auth.hashers import make_password
55
from django.utils.timezone import now
6-
7-
try:
8-
from mock import patch
9-
except ImportError: # nocv
10-
from unittest.mock import patch
11-
6+
from unittest.mock import patch
127
from vstutils.utils import redirect_stdany
138
from ._base import BaseTestCase, json
149
from .hosts import InventoriesTestCase, InvBaseTestCase # noqa: F401

0 commit comments

Comments
 (0)