def create_server(self, model):
     """ Update servers data in input model
     """
     url = ("%s%s" % (self.endpoint_url, facade_constants.SERVERS_URL))
     LOG.info("Updating input model with data: %s"
              % logging.mask_password(model))
     http_requests.post(url, body=model, headers=self._ks_auth_header())
     LOG.info("Updated input model successfully")
 def cobbler_deploy(self, id_, password):
     """ API call to re-image baremetal server and install OS.
     """
     server_model = self.get_server_by_id(id_)
     # Create payload for cobbler deploy
     body = {"servers": [server_model],
             "baremetal": {"hlmuser_password": password,
                           "disable_pwd_auth": "false"}}
     url = self.endpoint_url + facade_constants.OSINSTALL
     LOG.info("Os Install begins on %s" % id_)
     http_requests.post(url, body=body, headers=self._ks_auth_header())
 def commit_changes(self, id_, task):
     """ Commit input model changes
     """
     url = ("%s%s" % (self.endpoint_url, facade_constants.COMMIT_URL))
     LOG.info("[%s] Committing changes to input model for %s task" %
              (id_, task))
     body = {'message': facade_constants.COMMIT_MESSAGE % (id_, task)}
     return http_requests.post(url, body, headers=self._ks_auth_header())
Beispiel #4
0
 def test_post(self, mock_req):
     http_requests.post(self.url, body=FAKE_BODY)
 def _run(self, url, body=None):
     """ Execute a play and get corresponding process reference to
     track the play.
     """
     resp = http_requests.post(url, body, headers=self._ks_auth_header())
     return resp.get('pRef')
 def update_model(self, model):
     """ Update complete input model.
     """
     url = ("%s%s" % (self.endpoint_url, facade_constants.INPUT_MODEL_URL))
     LOG.info("Updating complete input model")
     http_requests.post(url, body=model, headers=self._ks_auth_header())