oc-cdtapi 3.9.4__py3-none-any.whl → 3.9.5__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
@@ -33,12 +33,14 @@ class ForemanAPI(HttpAPI):
33
33
  location_id = 5
34
34
  hostgroup = 11
35
35
  deploy_on = 1
36
- self.apiversion = int(os.getenv('FOREMAN_API_VERSION', "1") or "1")
36
+ self.apiversion = int(os.getenv("FOREMAN_API_VERSION", "1") or "1")
37
37
  self.defs = class_defaults(exp_date, location_id, hostgroup, deploy_on)
38
38
 
39
-
40
39
  def re(self, req):
41
- return posixpath.join(self.root, "api", req)
40
+ if not req.startswith("foreman_puppet"):
41
+ return posixpath.join(self.root, "api", req)
42
+ else:
43
+ return posixpath.join(self.root, req)
42
44
 
43
45
  def get_environment(self, env_name):
44
46
  """
@@ -498,7 +500,7 @@ class ForemanAPI(HttpAPI):
498
500
  return self.puppet_class_info_v1(classname)
499
501
  elif self.apiversion == 2:
500
502
  logging.debug('Passing to puppet_class_info_v2')
501
- return self.puppet_class_info_v1(classname)
503
+ return self.puppet_class_info_v2(classname)
502
504
 
503
505
  def puppet_class_info_v1(self, classname):
504
506
  """
@@ -513,8 +515,8 @@ class ForemanAPI(HttpAPI):
513
515
  Returns puppet class info
514
516
  """
515
517
  logging.debug('Reached puppet_class_info_v2')
516
- logging.debug('Passing to puppet_class_info_v1')
517
- return self.puppet_class_info_v1(classname)
518
+ response = self.get(posixpath.join("foreman_puppet", "api", "puppetclasses", classname), headers=self.headers)
519
+ return response.json()
518
520
 
519
521
  def smart_class_info(self, scid):
520
522
  """
@@ -598,8 +600,7 @@ class ForemanAPI(HttpAPI):
598
600
  Returns info about all hostgroup's puppetclasses
599
601
  """
600
602
  logging.debug('Reached get_hostgroup_puppetclasses_v2')
601
- params = {'hostgroup_id': str(hostgroup_id)}
602
- response = self.get('puppetclasses', params=params)
603
+ response = self.get(posixpath.join('foreman_puppet', 'api', 'hostgroups', str(hostgroup_id), 'puppetclasses'))
603
604
  return response.json()
604
605
 
605
606
  def add_puppet_class_to_host(self, hostname, params):
@@ -626,8 +627,8 @@ class ForemanAPI(HttpAPI):
626
627
  Adds the required puppet class to the host
627
628
  """
628
629
  logging.debug('Reached add_puppet_class_to_host_v2')
629
- logging.debug('Passing to add_puppet_class_to_host_v1')
630
- self.add_puppet_class_to_host_v1(hostname, params)
630
+ logging.debug('Params to be sent: %s' % params)
631
+ response = self.post(posixpath.join('foreman_puppet', 'api', 'hosts', hostname, 'puppetclass_ids'), headers=self.headers, data=params)
631
632
 
632
633
  def get_subnets(self):
633
634
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oc-cdtapi
3
- Version: 3.9.4
3
+ Version: 3.9.5
4
4
  Summary: Custom Development python API libraries
5
5
  License: Apache2.0
6
6
  Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*
@@ -2,14 +2,14 @@ oc_cdtapi/API.py,sha256=hpdnzyirYT_wISeznRmoqr-umYRT6uqKVwhmCXyj8Nk,12398
2
2
  oc_cdtapi/DevPIAPI.py,sha256=Nn63Ob0kA5XXuRZ3OIWG2rcnSsztKq9yPI6Lu2zX3Gk,1836
3
3
  oc_cdtapi/DmsAPI.py,sha256=j2Bx4Sryc4R1knyNjQmZshVuCePeD2q4W-fxv7zOMFc,9481
4
4
  oc_cdtapi/DmsGetverAPI.py,sha256=NIhWq2MDWaIBFLYJqkPCV9jZqM1HSZum6gIHquGHdQg,16085
5
- oc_cdtapi/ForemanAPI.py,sha256=FP_zeCgnSSYTPPck_xD0GsYH5BD0nLiOTiG1Qj4OkO8,39747
5
+ oc_cdtapi/ForemanAPI.py,sha256=w6MN86vJxYtHIZQ5gCehghV0D-EisGpCcBXEvfuUk3M,39986
6
6
  oc_cdtapi/JenkinsAPI.py,sha256=lZ8pe3a4eb_6h53JE7QLuzOSlu7Sqatc9PQwWhio9Vg,15748
7
7
  oc_cdtapi/NexusAPI.py,sha256=uU12GtHvKlWorFaPAnFcQ5AGEc94MZ5SdmfM2Pw3F7A,26122
8
8
  oc_cdtapi/TestServer.py,sha256=HV97UWg2IK4gOYAp9yaMdwFUWsw9v66MxyZdI3qQctA,2715
9
9
  oc_cdtapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- oc_cdtapi-3.9.4.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
11
- oc_cdtapi-3.9.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- oc_cdtapi-3.9.4.dist-info/METADATA,sha256=lNhBYahN9k9O2JftxqoGLirm50Pca2vWhxxPUz_1y98,276
13
- oc_cdtapi-3.9.4.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
14
- oc_cdtapi-3.9.4.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
15
- oc_cdtapi-3.9.4.dist-info/RECORD,,
10
+ oc_cdtapi-3.9.5.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
11
+ oc_cdtapi-3.9.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ oc_cdtapi-3.9.5.dist-info/METADATA,sha256=S64Fcjm0kP3W3bg7C5ENxYYtLdkQDKuyi0RVXqrswx8,276
13
+ oc_cdtapi-3.9.5.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
14
+ oc_cdtapi-3.9.5.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
15
+ oc_cdtapi-3.9.5.dist-info/RECORD,,