oc-cdtapi 3.23.4__py3-none-any.whl → 3.24.2__py3-none-any.whl

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.
oc_cdtapi/ForemanAPI.py CHANGED
@@ -73,7 +73,7 @@ class ForemanAPI(HttpAPI):
73
73
  return posixpath.join(self.root, "api", req)
74
74
  else:
75
75
  return posixpath.join(self.root, req)
76
-
76
+
77
77
  def get_host_by_owner(self, owner):
78
78
  """
79
79
  wrapper for api v1/v2
@@ -86,7 +86,7 @@ class ForemanAPI(HttpAPI):
86
86
  elif self.apiversion == 2:
87
87
  logging.debug('Passing to get_host_by_owner_v2')
88
88
  return self.get_host_by_owner_v2(owner)
89
-
89
+
90
90
  def get_host_by_owner_v2(self, owner):
91
91
  logging.debug('Reached get_host_by_owner_v2')
92
92
  logging.debug('owner = [%s]' % owner)
@@ -97,7 +97,7 @@ class ForemanAPI(HttpAPI):
97
97
  response = self.get('hosts', params=params).json()
98
98
  results = response.get('results')
99
99
  return results
100
-
100
+
101
101
  def get_environment(self, env_name):
102
102
  """
103
103
  wrapper for api v1/v2
@@ -245,7 +245,7 @@ class ForemanAPI(HttpAPI):
245
245
  deploy_on, custom_json):
246
246
  """
247
247
  Creates a host using the default parameters or the ones from an external json
248
- note that create_vm in engine actually sends db_task instead of hostname and custom_json,
248
+ note that create_vm in engine actually sends db_task instead of hostname and custom_json,
249
249
  other parms are ignored
250
250
  """
251
251
  logging.debug('Reached create_host_v1')
@@ -782,7 +782,7 @@ class ForemanAPI(HttpAPI):
782
782
  logging.debug('Reached is_host_powered_on')
783
783
  response = self.get(posixpath.join("hosts", hostname, "power")).json()
784
784
  return response['state'] == 'on'
785
-
785
+
786
786
  def host_power(self, hostname, action):
787
787
  """
788
788
  wrapper for api v1/v2
@@ -877,7 +877,7 @@ class ForemanAPI(HttpAPI):
877
877
  for hostgroup in hostgroups:
878
878
  if hostgroup.get("name") == hostgroup_name:
879
879
  return hostgroup.get ('id')
880
-
880
+
881
881
  logging.debug("Hostgroup [%s] not found, returning None" % hostgroup_name)
882
882
  return None
883
883
 
@@ -982,7 +982,7 @@ class ForemanAPI(HttpAPI):
982
982
  def set_host_expiry_v1(self, hostname, expiry):
983
983
  """
984
984
  Attempts to set host expiry date
985
- :param hostname: full hostname
985
+ :param hostname: full hostname
986
986
  :param expiry: expiry date in format yyyy-mm-dd
987
987
  """
988
988
  logging.debug('Reached set_host_expiry_v1')
@@ -994,7 +994,7 @@ class ForemanAPI(HttpAPI):
994
994
  def set_host_expiry_v2(self, hostname, expiry):
995
995
  """
996
996
  Attempts to set host expiry date
997
- :param hostname: full hostname
997
+ :param hostname: full hostname
998
998
  :param expiry: expiry date in format yyyy-mm-dd
999
999
  """
1000
1000
  logging.debug('Reached set_host_expiry_v2')
@@ -1224,14 +1224,14 @@ class ForemanAPI(HttpAPI):
1224
1224
  logging.debug('Reached set_host_owner')
1225
1225
  owner_id = self.get_owner(owner)
1226
1226
  owner_type = 'User'
1227
-
1227
+
1228
1228
  if not owner_id:
1229
1229
  owner_id = self.get_usergroup_id(owner)
1230
1230
  owner_type = 'Usergroup'
1231
-
1231
+
1232
1232
  if not owner_id:
1233
1233
  raise ForemanAPIError(f"The owner [{owner}] is not found")
1234
-
1234
+
1235
1235
  self.update_host(hostname, {"host": {"owner_id": owner_id, "owner_type": owner_type}})
1236
1236
 
1237
1237
 
@@ -1247,6 +1247,20 @@ class ForemanAPI(HttpAPI):
1247
1247
  pl['host']['owner_id'] = owner_id
1248
1248
  self.update_host(hostname, pl)
1249
1249
 
1250
+ def set_backup_policy(self, hostname, backup_policy):
1251
+ """
1252
+ Change backup policy
1253
+ :param hostname: str
1254
+ :param backup_policy: str
1255
+ """
1256
+ logging.debug('Reached set_backup_policy')
1257
+ payload = {
1258
+ "parameter": {
1259
+ "value": backup_policy
1260
+ }
1261
+ }
1262
+ self.update_host(hostname=hostname, payload=payload)
1263
+
1250
1264
  def get_job_template_id(self, template_name):
1251
1265
  """
1252
1266
  Get template ID by name. Cache results to avoid repeated API calls.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oc-cdtapi
3
- Version: 3.23.4
3
+ Version: 3.24.2
4
4
  Summary: Custom Development python API libraries
5
5
  License: Apache2.0
6
6
  Requires-Python: >=3.6
@@ -3,7 +3,7 @@ oc_cdtapi/Dbsm2API.py,sha256=WDBst1dCAmDVU9d9Ogzwp2nkjtKZ4thU2xG4sAPI_Nk,9963
3
3
  oc_cdtapi/DevPIAPI.py,sha256=9WND9ld66eHmC5qoLJq3KDYSoO-pP69UqOQsGZNLZYg,1835
4
4
  oc_cdtapi/DmsAPI.py,sha256=eNFdwQLhCbPvHB5SUtP4QcZZtSdjkgt_Cxn3oQ3iJ5s,15605
5
5
  oc_cdtapi/DmsGetverAPI.py,sha256=ZPU4HlF59fngKu5mSFhtss3rlBuduffDOSm_y3XWrxk,15556
6
- oc_cdtapi/ForemanAPI.py,sha256=oL_OdUgRL_7z9te83lmLarInDaKWW1_rjwXaWTZajIY,48401
6
+ oc_cdtapi/ForemanAPI.py,sha256=I8AIOkJk8_HQ_YJclhePUUn_FNRbTkKG00CXmZtuQdk,48727
7
7
  oc_cdtapi/JenkinsAPI.py,sha256=lZ8pe3a4eb_6h53JE7QLuzOSlu7Sqatc9PQwWhio9Vg,15748
8
8
  oc_cdtapi/NexusAPI.py,sha256=uU12GtHvKlWorFaPAnFcQ5AGEc94MZ5SdmfM2Pw3F7A,26122
9
9
  oc_cdtapi/PgAPI.py,sha256=URSz7qu-Ir7AOj0jI3ucTXn2PM-nC96nmPZI746OLjA,14356
@@ -12,9 +12,9 @@ oc_cdtapi/RundeckAPI.py,sha256=O3LmcFaHSz8UqeUyIHTTEMJncDD191Utd-iZaeJay2s,24243
12
12
  oc_cdtapi/TestServer.py,sha256=HV97UWg2IK4gOYAp9yaMdwFUWsw9v66MxyZdI3qQctA,2715
13
13
  oc_cdtapi/VaultAPI.py,sha256=P-x_PsWe_S0mGUKTCmR1KhUjdfs7GmyaltjGQcnWj_s,2967
14
14
  oc_cdtapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- oc_cdtapi-3.23.4.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
16
- oc_cdtapi-3.23.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- oc_cdtapi-3.23.4.dist-info/METADATA,sha256=vm9AmaXHNBtw1DznVmDF9PLEfIDC1xn0bNrxE-mV0uU,504
18
- oc_cdtapi-3.23.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- oc_cdtapi-3.23.4.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
20
- oc_cdtapi-3.23.4.dist-info/RECORD,,
15
+ oc_cdtapi-3.24.2.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
16
+ oc_cdtapi-3.24.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ oc_cdtapi-3.24.2.dist-info/METADATA,sha256=i8t_cC5famMxrEnhwIX_qR40f7w9NomCxNxCzHvmz_E,504
18
+ oc_cdtapi-3.24.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ oc_cdtapi-3.24.2.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
20
+ oc_cdtapi-3.24.2.dist-info/RECORD,,