Skip to content

Commit 1089ce0

Browse files
committed
Merge branch 'nishant-umg' into sign-umg-v2
2 parents 253505d + 3cc13cd commit 1089ce0

File tree

11 files changed

+193
-68
lines changed

11 files changed

+193
-68
lines changed

.changelog/changelog.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
| tag | date | title |
2+
|---------|------------|------------------------|
3+
| v2.10.0 | 2024-08-22 | User Sync Tool v2.10.0 |
4+
5+
# Fixes
6+
7+
* #825 send `start_sync()` signal when querying groups for auto-create purposes
8+
* #834 make TimeoutException a child of AssertionException so we don't show a stack trace
9+
* #837 fix typo in sign engine log message
10+
* #840 push strategy fails with unhandled exception
11+
* e61ec81 Fix issue with all users setting
12+
13+
# New Features
14+
15+
* 5e9e01b Ability to exclude Sign users in Sign Sync
16+
* d761c5e Introduce option to limit scope of Adobe-only users to just those that have groups to remove in the current sync. See [the manual](https://github.com/adobe-apiplatform/user-sync.py/blob/8082c987c79eddcc3fc06f31a1c32de300a30cd7/en/user-manual/configuring_user_sync_tool.md#limits-config) for more information
17+
18+
---
19+
20+
| tag | date | title |
21+
|------------|------------|---------------------------|
22+
| v2.10.0rc4 | 2024-08-13 | User Sync Tool v2.10.0rc4 |
23+
24+
# Fixes
25+
26+
* #825 send `start_sync()` signal when querying groups for auto-create purposes
27+
* #834 make TimeoutException a child of AssertionException so we don't show a stack trace
28+
* #837 fix typo in sign engine log message
29+
* #840 push strategy fails with unhandled exception
30+
* e61ec81 Fix issue with all users setting
31+
32+
# New Features
33+
34+
* 5e9e01b Ability to exclude Sign users in Sign Sync
35+
* d761c5e Introduce option to limit scope of Adobe-only users to just those that have groups to remove in the current sync. See [the manual](https://github.com/adobe-apiplatform/user-sync.py/blob/8082c987c79eddcc3fc06f31a1c32de300a30cd7/en/user-manual/configuring_user_sync_tool.md#limits-config) for more information
36+
37+
---
38+
39+
| tag | date | title |
40+
|------------|------------|---------------------------|
41+
| v2.10.0rc3 | 2024-07-29 | User Sync Tool v2.10.0rc3 |
42+
43+
# Fixes
44+
45+
* #825 send `start_sync()` signal when querying groups for auto-create purposes
46+
* #834 make TimeoutException a child of AssertionException so we don't show a stack trace
47+
* #837 fix typo in sign engine log message
48+
* #840 push strategy fails with unhandled exception
49+
* e61ec81 Fix issue with all users setting
50+
51+
# New Features
52+
53+
* d761c5e Introduce option to limit scope of Adobe-only users to just those that have groups to remove in the current sync. See [the manual](https://github.com/adobe-apiplatform/user-sync.py/blob/8082c987c79eddcc3fc06f31a1c32de300a30cd7/en/user-manual/configuring_user_sync_tool.md#limits-config) for more information
54+
55+
---
56+
157
| tag | date | title |
258
|------------|------------|---------------------------|
359
| v2.10.0rc2 | 2023-10-19 | User Sync Tool v2.10.0rc2 |
@@ -8,10 +64,7 @@
864

965
# New Features
1066

11-
* d761c5e Introduce option to limit scope of Adobe-only users to just those that
12-
have groups to remove in the current sync. See [the
13-
manual](https://github.com/adobe-apiplatform/user-sync.py/blob/8082c987c79eddcc3fc06f31a1c32de300a30cd7/en/user-manual/configuring_user_sync_tool.md#limits-config)
14-
for more information
67+
* d761c5e Introduce option to limit scope of Adobe-only users to just those that have groups to remove in the current sync. See [the manual](https://github.com/adobe-apiplatform/user-sync.py/blob/8082c987c79eddcc3fc06f31a1c32de300a30cd7/en/user-manual/configuring_user_sync_tool.md#limits-config) for more information
1568

1669
---
1770

.github/workflows/package.yml

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
- extension_support: 1
1717
variant_tag: ""
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020
- name: Set up Python
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.11'
23+
python-version: '3.12'
2424
- name: Get version tag
2525
id: get_version
2626
uses: battila7/get-version-action@v2
@@ -67,11 +67,11 @@ jobs:
6767
- extension_support: 1
6868
variant_tag: ""
6969
steps:
70-
- uses: actions/checkout@v2
70+
- uses: actions/checkout@v4
7171
- name: Set up Python
72-
uses: actions/setup-python@v2
72+
uses: actions/setup-python@v5
7373
with:
74-
python-version: '3.9'
74+
python-version: '3.12'
7575
- name: Get version tag
7676
id: get_version
7777
uses: battila7/get-version-action@v2
@@ -116,10 +116,10 @@ jobs:
116116
- extension_support: 1
117117
variant_tag: ""
118118
steps:
119-
- uses: actions/checkout@v2
120-
- uses: actions/setup-python@v2
119+
- uses: actions/checkout@v4
120+
- uses: actions/setup-python@v5
121121
with:
122-
python-version: '3.9'
122+
python-version: '3.12'
123123
- name: Get version tag
124124
id: get_version
125125
uses: battila7/get-version-action@v2
@@ -143,39 +143,54 @@ jobs:
143143
path: dist/*.zip
144144
retention-days: 30
145145

146-
centos:
146+
rocky:
147147
runs-on: ubuntu-latest
148148
env:
149149
LC_ALL: en_US.utf8
150150
LANG: en_US.utf8
151151
container:
152-
image: centos:7
152+
image: ${{ matrix.container }}
153153
strategy:
154154
matrix:
155155
include:
156-
- extension_support: 0
156+
- container: "rockylinux:8"
157+
extension_support: 0
157158
variant_tag: "-noext"
158-
- extension_support: 1
159+
- container: "rockylinux:8"
160+
extension_support: 1
161+
variant_tag: ""
162+
- container: "rockylinux:9"
163+
extension_support: 0
164+
variant_tag: "-noext"
165+
- container: "rockylinux:9"
166+
extension_support: 1
159167
variant_tag: ""
160168
steps:
161-
- uses: actions/checkout@v2
169+
- uses: actions/checkout@v4
162170
- name: Get version tag
163171
id: get_version
164172
uses: battila7/get-version-action@v2
165-
- name: Centos-Install dependencies
173+
- name: Update yum dependencies
174+
run: yum update -y
175+
- name: Rocky 8 dependencies
176+
if: ${{ matrix.container == 'rockylinux:8' }}
177+
run: yum install -y pkgconfig gcc openssl-devel dbus-glib-devel python3-dbus sqlite-devel libffi-devel wget make findutils glibc-langpack-en
178+
- name: Rocky 9 dependencies
179+
if: ${{ matrix.container == 'rockylinux:9' }}
180+
run: yum install -y pkgconfig gcc openssl-devel dbus-glib-devel python3-dbus sqlite-devel libffi-devel krb5-devel dbus-daemon wget make findutils glibc-langpack-en
181+
- name: Build Python 3.12
166182
run: |
167-
yum install -y pkgconfig gcc openssl-devel dbus-glib-devel dbus-python sqlite-devel libffi-devel wget make
168183
mkdir tmp && cd tmp
169-
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
170-
tar xzf Python-3.9.7.tgz
171-
cd Python-3.9.7
184+
wget https://www.python.org/ftp/python/3.12.4/Python-3.12.4.tgz
185+
tar xzf Python-3.12.4.tgz
186+
cd Python-3.12.4
172187
./configure --enable-optimizations --enable-shared --enable-loadable-sqlite-extensions
173188
make altinstall
174189
cd ../..
175190
- name: Build executable
176191
run: |
177192
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
178-
/usr/local/bin/python3.9 -m venv venv
193+
/usr/local/bin/python3.12 -m venv venv
179194
source venv/bin/activate
180195
# for some reason, pycryptodome won't install when
181196
# setuptools is installed/upgraded, so install it before
@@ -194,21 +209,23 @@ jobs:
194209
- name: Get build
195210
run: |
196211
cd dist
197-
tar czf "user-sync-${UST_VERSION}${UST_VARIANT_TAG}-centos.tar.gz" user-sync
212+
LABEL=$(echo $CONTAINER | sed "s/linux://g")
213+
tar czf "user-sync-${UST_VERSION}${UST_VARIANT_TAG}-${LABEL}.tar.gz" user-sync
198214
env:
199215
UST_VARIANT_TAG: ${{matrix.variant_tag}}
200216
UST_VERSION: ${{ steps.get_version.outputs.version }}
217+
CONTAINER: ${{ matrix.container }}
201218
- name: Make artifact
202219
uses: actions/upload-artifact@v2
203220
with:
204-
name: centos
221+
name: rocky
205222
path: dist/*.tar.gz
206223
retention-days: 30
207224

208225
examples:
209226
runs-on: ubuntu-latest
210227
steps:
211-
- uses: actions/checkout@v2
228+
- uses: actions/checkout@v4
212229
- name: user-sync-examples-zip
213230
run: |
214231
cd examples
@@ -229,9 +246,9 @@ jobs:
229246

230247
release:
231248
runs-on: ubuntu-latest
232-
needs: [centos, ubuntu-jammy, ubuntu-focal, examples, windows]
249+
needs: [rocky, ubuntu-jammy, ubuntu-focal, examples, windows]
233250
steps:
234-
- uses: actions/checkout@v2
251+
- uses: actions/checkout@v4
235252
- name: Create Release
236253
id: create_release
237254
uses: actions/create-release@v1
@@ -254,6 +271,6 @@ jobs:
254271
uses: battila7/get-version-action@v2
255272
- uses: AButler/[email protected]
256273
with:
257-
files: 'examples/*;ubuntu-jammy/*;ubuntu-focal/*;centos/*'
274+
files: 'examples/*;ubuntu-jammy/*;ubuntu-focal/*;rocky/*'
258275
repo-token: ${{ secrets.GITHUB_TOKEN }}
259276
release-tag: ${{ steps.get_version.outputs.version }}

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
'configparser==3.7.4',
5858
'schema==0.7.2',
5959
'sign-client~=0.2.1',
60+
'setuptools~=72.1.0',
6061
],
6162
extras_require={
6263
':sys_platform=="linux" or sys_platform=="linux2"': [

sign_client/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
packages=find_packages(),
4141
install_requires=[
4242
"requests~=2.26.0",
43-
"aiohttp~=3.8.1",
43+
"aiohttp~=3.9.0",
4444
],
4545
zip_safe=False)

sign_client/sign_client/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def _await_calls(self, handle, headers, objects):
255255
# prepare a list of calls to make * Note: calls are prepared by using call
256256
# syntax (eg, func() and not func), but they will not be run until executed by the wait
257257
# split into batches of self.bach_size to avoid taking too much memory
258-
calls = [handle(sem, o, headers, session) for o in objects]
258+
calls = [asyncio.create_task(handle(sem, o, headers, session)) for o in objects]
259259
await asyncio.wait(calls)
260260

261261
async def _get_user(self, semaphore, user_id, header, session):

sign_client/sign_client/error.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ def is_reported(self):
3131
return self.reported
3232

3333

34-
class TimeoutException(Exception):
34+
class TimeoutException(AssertionException):
3535
def __init__(self, message):
36-
super(AssertionException, self).__init__(message)
37-
self.reported = False
38-
39-
def set_reported(self):
40-
self.reported = True
41-
42-
def is_reported(self):
43-
return self.reported
36+
super().__init__(message)

user_sync/config/sign_sync.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ def config_schema() -> Schema:
6262
}
6363
})
6464

65+
def connector_schema() -> Schema:
66+
from schema import And, Optional, Or, Regex
67+
return Schema({
68+
'host': str,
69+
Or('integration_key', 'secure_integration_key'): str,
70+
'admin_email': str,
71+
Optional('create_users'): Optional(bool),
72+
Optional('deactivate_users'): Optional(bool),
73+
Optional('exclusions'): {
74+
Optional('groups'): list,
75+
Optional('users'): list,
76+
}
77+
})
6578

6679
class SignConfigLoader(ConfigLoader):
6780
"""
@@ -102,7 +115,7 @@ def __init__(self, args: dict):
102115
filename, encoding = self._config_file_info()
103116
self.config_loader = ConfigFileLoader(encoding, self.ROOT_CONFIG_PATH_KEYS, self.SUB_CONFIG_PATH_KEYS)
104117
self.raw_config = self._load_raw_config(filename, encoding)
105-
self._validate(self.raw_config)
118+
self._validate(config_schema, self.raw_config)
106119
self.main_config = self.load_main_config(filename, self.raw_config)
107120
self.invocation_options = self.load_invocation_options()
108121
self.directory_groups = self.load_directory_groups()
@@ -149,10 +162,10 @@ def _load_raw_config(self, filename, encoding) -> dict:
149162
return self.config_loader.load_root_config(filename)
150163

151164
@staticmethod
152-
def _validate(raw_config: dict):
165+
def _validate(schm, raw_config: dict):
153166
from schema import SchemaError
154167
try:
155-
config_schema().validate(raw_config)
168+
schm().validate(raw_config)
156169
except SchemaError as e:
157170
raise ConfigValidationError(e.code) from e
158171

@@ -299,11 +312,14 @@ def get_target_options(self) -> dict[str, dict]:
299312
if self.DEFAULT_ORG_NAME not in target_configs:
300313
raise AssertionException(f"'sign_orgs' config must specify a connector with '{self.DEFAULT_ORG_NAME}' key")
301314
primary_options = self.config_loader.load_sub_config(target_configs[self.DEFAULT_ORG_NAME])
315+
self._validate(connector_schema, primary_options)
302316
all_options = {}
303317
for target_id, config_file in target_configs.items():
304318
if target_id == self.DEFAULT_ORG_NAME:
305319
continue
306-
all_options[target_id] = self.config_loader.load_sub_config(config_file)
320+
cfg = self.config_loader.load_sub_config(config_file)
321+
self._validate(connector_schema, cfg)
322+
all_options[target_id] = cfg
307323
all_options[self.DEFAULT_ORG_NAME] = primary_options
308324
return all_options
309325

user_sync/connector/connector_sign.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from ..error import AssertionException
2828
from sign_client.client import SignClient
2929
from pathlib import Path
30+
import re
3031

3132

3233
class SignConnector(object):
@@ -45,6 +46,20 @@ def __init__(self, caller_options, org_name, test_mode, connection, cache_config
4546
sign_builder.require_string_value('admin_email')
4647
self.create_users = sign_builder.require_value('create_users', bool)
4748
self.deactivate_users = sign_builder.require_value('deactivate_users', bool)
49+
50+
exclusion_config = caller_config.get_dict_config('exclusions', True)
51+
exclusion_builder = OptionsBuilder(exclusion_config)
52+
exclusion_builder.set_value('groups', list, [])
53+
exclusion_builder.set_value('users', list, [])
54+
55+
self.exclusion_options = exclusion_builder.get_options()
56+
57+
if 'users' in self.exclusion_options:
58+
compiled_rules = []
59+
for rule in self.exclusion_options['users']:
60+
compiled_rules.append(re.compile(rule))
61+
self.exclusion_options['users'] = compiled_rules
62+
4863
store_path = Path(cache_config['path'])
4964

5065
options = sign_builder.get_options()

user_sync/connector/connector_umapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def get_groups(self):
183183
return list(self.iter_groups())
184184

185185
def iter_groups(self):
186+
self.connection.start_sync()
186187
try:
187188
for g in umapi_client.GroupsQuery(self.connection):
188189
yield g

0 commit comments

Comments
 (0)