Skip to content

Commit

Permalink
Use server_config as named argument only.
Browse files Browse the repository at this point in the history
(cherry picked from commit 480e4c1)
  • Loading branch information
tpapaioa authored and web-flow committed May 28, 2024
1 parent d997df9 commit 4b9c82c
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 173 deletions.
2 changes: 1 addition & 1 deletion docs/create_organization_nailgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main():
auth=('admin', 'changeme'), # Use these credentials…
url='https://sat1.example.com', # …to talk to this server.
)
org = Organization(server_config, name='junk org').create()
org = Organization(server_config=server_config, name='junk org').create()
pprint(org.get_values()) # e.g. {'name': 'junk org', …}
org.delete()

Expand Down
8 changes: 5 additions & 3 deletions docs/create_user_nailgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ def main():
"""Create an identical user account on a pair of satellites."""
server_configs = ServerConfig.get('sat1'), ServerConfig.get('sat2')
for server_config in server_configs:
org = Organization(server_config).search(query={'search': 'name="Default_Organization"'})[0]
org = Organization(server_config=server_config).search(
query={'search': 'name="Default_Organization"'}
)[0]
# The LDAP authentication source with an ID of 1 is internal. It is
# nearly guaranteed to exist and be functioning.
user = User(
server_config,
auth_source=1, # or: AuthSourceLDAP(server_config, id=1),
server_config=server_config,
auth_source=1, # or: AuthSourceLDAP(server_config=server_config, id=1),
login='Alice',
mail='[email protected]',
organization=[org],
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ save some of our work for later re-use::
... auth=('admin', 'changeme'), # Use these credentials…
... url='https://sat1.example.com', # …to talk to this server.
... ) # More options are available, e.g. disabling SSL verification.
>>> org = Organization(server_config, name='junk org').create()
>>> org = Organization(server_config=server_config, name='junk org').create()
>>> org.name == 'junk org' # Access all attrs likewise, e.g. `org.label`
True
>>> org.delete()
Expand Down
Loading

0 comments on commit 4b9c82c

Please sign in to comment.