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

[WTF] Set version as 1.1.0 - to be closed !?! #57

Closed
wants to merge 30 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dc20c86
Add code to build debian packages
Sep 23, 2017
7350d2b
Merge pull request #48 from Alignak-monitoring-contrib/develop+build
mohierf Sep 25, 2017
0ebaba5
Fix package for release + modify dev version
Sep 27, 2017
06396e5
For #50: allow to create a service for a diiferent host. Manage templ…
mohierf Oct 1, 2017
6c613b6
Merge pull request #51 from Alignak-monitoring-contrib/fix-#50
mohierf Oct 1, 2017
6b63447
Merge pull request #49 from Alignak-monitoring-contrib/develop+build
mohierf Oct 2, 2017
dc13399
Add missing tests
mohierf Oct 2, 2017
dd65c47
Merge pull request #52 from Alignak-monitoring-contrib/fix-#50
ddurieux Oct 2, 2017
159f5bf
Change backend_client script shebang
mohierf Oct 16, 2017
d922d4a
Merge pull request #54 from Alignak-monitoring-contrib/script-shebang
ddurieux Oct 16, 2017
c1078e8
Fix #55: get methode documentation error
mohierf Oct 20, 2017
c98ce41
Fix #55: get method documentation error - fix python 3.4 six installa…
mohierf Oct 20, 2017
40e8bf6
Merge pull request #56 from Alignak-monitoring-contrib/fix-#55
ddurieux Oct 20, 2017
0611083
Set version as 1.1.0
mohierf Oct 21, 2017
c41e074
client with Requests.Session
lnlrbr Nov 17, 2017
dc852e0
add property token
lnlrbr Nov 21, 2017
252509d
For #60: Allow to import unnamed items (history)
mohierf Nov 20, 2017
96d862f
For #60: Allow to import unnamed items (logcheckresult and userrestri…
mohierf Dec 5, 2017
3d680bc
Fix a broken test because of recent backend modifications in the host…
mohierf Dec 5, 2017
bd1312d
Fix missing requirement urllib3
mohierf Dec 5, 2017
67f29a3
Set version as 1.2.0
mohierf Dec 15, 2017
a43f675
Closes #63: manage embedded resource in userrestrictrole
mohierf Jan 17, 2018
81744bb
Merge pull request #65 from Alignak-monitoring-contrib/closes-#63
mohierf Feb 5, 2018
54e728c
Set version as 1.2.1
mohierf Feb 5, 2018
306287c
Manage templating for item deletion
mohierf Feb 8, 2018
764bfb8
Closes #68 - do not stop multiple add/update on first error
mohierf Feb 25, 2018
1661110
Merge pull request #69 from Alignak-monitoring-contrib/delete-templates
mohierf Feb 25, 2018
0c34e14
Merge pull request #70 from Alignak-monitoring-contrib/closes-#68
mohierf Feb 25, 2018
87d9d05
Set alignak-backend-cli version to 1.2.0
mohierf Feb 25, 2018
614c867
Set version to 1.3.0
mohierf Feb 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
For #60: Allow to import unnamed items (history)
mohierf authored and ddurieux committed Dec 6, 2017
commit 252509d24b7fdf964ae5d4d195fd5e21a6ba11dd
45 changes: 27 additions & 18 deletions alignak_backend_client/backend_client.py
Original file line number Diff line number Diff line change
@@ -811,7 +811,8 @@ def create_update_resource(self, resource_name, name, update=False):
count = 0
for json_item in json_data:
logger.info("-> json item: %s", json_item)
if name is None and ('name' not in json_item or not json_item['name']):
if resource_name not in ['history'] and name is None \
and ('name' not in json_item or not json_item['name']):
logger.warning("-> unnamed '%s'!", resource_name)
continue

@@ -867,23 +868,25 @@ def create_update_resource(self, resource_name, name, update=False):

params = {'where': json.dumps(params)}

logger.info("Trying to get %s: '%s', params: %s", resource_name, item_name, params)
response = self.backend.get(resource_name, params=params)
if response['_items']:
found_item = response['_items'][0]
found_id = found_item['_id']
found_etag = found_item['_etag']
logger.info("-> found %s '%s': %s", resource_name, item_name, found_id)

if not update:
logger.warning("-> '%s' %s cannot be created because it already exists!",
resource_name, item_name)
continue
else:
if update:
logger.warning("-> '%s' %s cannot be updated because it does not exist!",
resource_name, item_name)
continue
if name:
logger.info("Trying to get %s: '%s', params: %s",
resource_name, item_name, params)
response = self.backend.get(resource_name, params=params)
if response['_items']:
found_item = response['_items'][0]
found_id = found_item['_id']
found_etag = found_item['_etag']
logger.info("-> found %s '%s': %s", resource_name, item_name, found_id)

if not update:
logger.warning("-> '%s' %s cannot be created because it already "
"exists!", resource_name, item_name)
continue
else:
if update:
logger.warning("-> '%s' %s cannot be updated because it does not "
"exist!", resource_name, item_name)
continue

# Item data updated with provided information if some

@@ -1002,13 +1005,19 @@ def create_update_resource(self, resource_name, name, update=False):

if not update:
# Trying to create a new element
if not item_data['name']:
item_data.pop('name')
logger.info("-> trying to create the %s: %s.", resource_name, item_name)
logger.debug("-> with: %s.", item_data)
if not self.dry_run:
response = self.backend.post(resource_name, item_data, headers=None)
else:
response = {'_status': 'OK', '_id': '_fake', '_etag': '_fake'}
else:
if not name:
logger.warning("-> can not update '%s' with no name!", resource_name)
continue

# Trying to update an element
logger.info("-> trying to update the %s: %s.", resource_name, item_name)
logger.debug("-> with: %s.", item_data)