besapi 3.7.2__tar.gz → 3.7.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: besapi
3
- Version: 3.7.2
3
+ Version: 3.7.6
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -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.7.2"
32
+ __version__ = "3.7.6"
33
33
 
34
34
  besapi_logger = logging.getLogger("besapi")
35
35
 
@@ -345,8 +345,11 @@ class BESConnection:
345
345
  besapi_logger.info("Query did not return any results")
346
346
  else:
347
347
  besapi_logger.error("%s\n%s", err2, rel_result.text)
348
+ result.append("ERROR: " + rel_result.text)
348
349
  raise
349
350
  else:
351
+ besapi_logger.error("%s\n%s", err, rel_result.text)
352
+ result.append("ERROR: " + rel_result.text)
350
353
  raise
351
354
  return result
352
355
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: besapi
3
- Version: 3.7.2
3
+ Version: 3.7.6
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -54,6 +54,9 @@ class BESCLInterface(Cmd):
54
54
  def do_get(self, line):
55
55
  """Perform get request to BigFix server using provided api endpoint argument"""
56
56
 
57
+ # remove any extra whitespace
58
+ line = line.strip()
59
+
57
60
  # Remove root server prefix:
58
61
  # if root server prefix is not removed
59
62
  # and root server is given as IP Address,
@@ -80,6 +83,26 @@ class BESCLInterface(Cmd):
80
83
  else:
81
84
  self.pfeedback("Not currently logged in. Type 'login'.")
82
85
 
86
+ def do_delete(self, line):
87
+ """Perform delete request to BigFix server using provided api endpoint argument"""
88
+
89
+ # remove any extra whitespace
90
+ line = line.strip()
91
+
92
+ # Remove root server prefix:
93
+ if "/api/" in line:
94
+ line = str(line).split("/api/", 1)[1]
95
+ self.pfeedback("get " + line)
96
+
97
+ if self.bes_conn:
98
+ output_item = self.bes_conn.delete(line)
99
+
100
+ print(output_item)
101
+ # print(output_item.besdict)
102
+ # print(output_item.besjson)
103
+ else:
104
+ self.pfeedback("Not currently logged in. Type 'login'.")
105
+
83
106
  def do_post(self, statement):
84
107
  """post file as data to path"""
85
108
  print(statement)
@@ -366,9 +389,13 @@ class BESCLInterface(Cmd):
366
389
  def do_import_bes(self, statement):
367
390
  """import bes file"""
368
391
 
369
- self.poutput(f"Import file: {statement.args}")
392
+ bes_file_path = str(statement.args).strip()
393
+
394
+ site_path = self.bes_conn.get_current_site_path(None)
395
+
396
+ self.poutput(f"Import file: {bes_file_path}")
370
397
 
371
- self.poutput(self.bes_conn.import_bes_to_site(str(statement.args)))
398
+ self.poutput(self.bes_conn.import_bes_to_site(bes_file_path, site_path))
372
399
 
373
400
  complete_upload = Cmd.path_complete
374
401
 
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