besapi 3.2.2__tar.gz → 3.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {besapi-3.2.2/src/besapi.egg-info → besapi-3.2.4}/PKG-INFO +1 -1
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/besapi.py +29 -1
- {besapi-3.2.2 → besapi-3.2.4/src/besapi.egg-info}/PKG-INFO +1 -1
- {besapi-3.2.2 → besapi-3.2.4}/tests/tests.py +15 -0
- {besapi-3.2.2 → besapi-3.2.4}/LICENSE.txt +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/MANIFEST.in +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/README.md +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/pyproject.toml +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/setup.cfg +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/setup.py +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/__init__.py +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/__main__.py +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/schemas/BES.xsd +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/schemas/BESAPI.xsd +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi/schemas/BESActionSettings.xsd +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi.egg-info/SOURCES.txt +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi.egg-info/dependency_links.txt +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi.egg-info/requires.txt +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/besapi.egg-info/top_level.txt +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/bescli/__init__.py +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/bescli/__main__.py +0 -0
- {besapi-3.2.2 → besapi-3.2.4}/src/bescli/bescli.py +0 -0
|
@@ -29,7 +29,7 @@ import requests
|
|
|
29
29
|
from lxml import etree, objectify
|
|
30
30
|
from pkg_resources import resource_filename
|
|
31
31
|
|
|
32
|
-
__version__ = "3.2.
|
|
32
|
+
__version__ = "3.2.4"
|
|
33
33
|
|
|
34
34
|
besapi_logger = logging.getLogger("besapi")
|
|
35
35
|
|
|
@@ -393,6 +393,34 @@ class BESConnection:
|
|
|
393
393
|
self.session.cookies.clear()
|
|
394
394
|
self.session.close()
|
|
395
395
|
|
|
396
|
+
def set_dashboard_variable_value(
|
|
397
|
+
self, dashboard_name, var_name, var_value, private=False
|
|
398
|
+
):
|
|
399
|
+
"""set the variable value from a dashboard datastore"""
|
|
400
|
+
|
|
401
|
+
dash_var_xml = f"""<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
|
|
402
|
+
<DashboardData>
|
|
403
|
+
<Dashboard>{dashboard_name}</Dashboard>
|
|
404
|
+
<Name>{var_name}</Name>
|
|
405
|
+
<IsPrivate>{str(private).lower()}</IsPrivate>
|
|
406
|
+
<Value>{var_value}</Value>
|
|
407
|
+
</DashboardData>
|
|
408
|
+
</BESAPI>
|
|
409
|
+
"""
|
|
410
|
+
|
|
411
|
+
return self.post(
|
|
412
|
+
f"dashboardvariable/{dashboard_name}/{var_name}", data=dash_var_xml
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
def get_dashboard_variable_value(self, dashboard_name, var_name):
|
|
416
|
+
"""get the variable value from a dashboard datastore"""
|
|
417
|
+
|
|
418
|
+
return str(
|
|
419
|
+
self.get(
|
|
420
|
+
f"dashboardvariable/{dashboard_name}/{var_name}"
|
|
421
|
+
).besobj.DashboardData.Value
|
|
422
|
+
)
|
|
423
|
+
|
|
396
424
|
def validate_site_path(self, site_path, check_site_exists=True, raise_error=False):
|
|
397
425
|
"""make sure site_path is valid"""
|
|
398
426
|
|
|
@@ -5,6 +5,7 @@ Test besapi
|
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
7
7
|
import os
|
|
8
|
+
import random
|
|
8
9
|
import subprocess
|
|
9
10
|
import sys
|
|
10
11
|
|
|
@@ -128,6 +129,20 @@ if bigfix_cli.bes_conn:
|
|
|
128
129
|
assert "test_besapi_upload.txt</URL>" in str(upload_result)
|
|
129
130
|
print(bigfix_cli.bes_conn.parse_upload_result_to_prefetch(upload_result))
|
|
130
131
|
|
|
132
|
+
dashboard_name = "_PyBESAPI_tests.py"
|
|
133
|
+
var_name = "TestVarName"
|
|
134
|
+
var_value = "TestVarValue " + str(random.randint(0, 9999))
|
|
135
|
+
|
|
136
|
+
print(
|
|
137
|
+
bigfix_cli.bes_conn.set_dashboard_variable_value(
|
|
138
|
+
dashboard_name, var_name, var_value
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
assert var_value in str(
|
|
143
|
+
bigfix_cli.bes_conn.get_dashboard_variable_value(dashboard_name, var_name)
|
|
144
|
+
)
|
|
145
|
+
|
|
131
146
|
if os.name == "nt":
|
|
132
147
|
subprocess.run(
|
|
133
148
|
'CMD /C python -m besapi ls clear ls conf "query number of bes computers" version error_count exit',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|