def validate(self): """Validate that script/playbook path is valid and exists.""" # schema validation for ansible_orchestrate schema schema_validator(schema_data=self.build_profile(self.action), schema_files=[self.__schema_file_path__], schema_ext_files=[self.__schema_ext_path__]) # verifying when script or playbook is present in the orchestrate task, the name key provides a path that exist if self.script: if os.path.exists(self.script.get('name').split(' ', 1)[0]): self.logger.debug('Found Action resource script %s' % self.script.get('name')) else: raise TefloOrchestratorError( 'Cannot find Action resource script %s' % self.script.get('name')) elif self.playbook: if os.path.exists(self.playbook.get('name').split(' ', 1)[0]): self.logger.debug('Found Action resource playbook %s' % self.playbook.get('name')) else: raise TefloOrchestratorError( 'Cannot find Action resource playbook %s' % self.playbook.get('name'))
def test_schema_validator_with_creds(): params = dict(key1='val1', key2=['val2', 'val3']) creds = dict(name='test', username='******', password='******') schema_validator( schema_data=params, schema_creds=creds, schema_files=[os.path.abspath('../assets/schemas/schema_test.yml')])
def test_schema_validator_failure(): params = dict(key1=1, key2=['val2', 'val3']) with pytest.raises(Exception): schema_validator( schema_data=params, schema_files=[ os.path.abspath('../assets/schemas/schema_test.yml') ])
def validate(self): # validate teflo plugin schema first schema_validator(schema_data=self.build_profile(self.asset), schema_files=[self.__schema_file_path__], schema_ext_files=[self.__schema_ext_path__]) # validate linchpin pinfile self._create_pinfile() code, results = self._lp_action(validate=True) self.logger.info(code) self.logger.info(results) if code != 0: self.logger.error('linchpin topology rc: %s' % code) self.logger.error(results) raise TefloProvisionerError('Linchpin failed to validate pinfile.')
def validate(self): # Validate commands with the osp client api for cmd in self.provider_params: if cmd.find('add') != -1 or cmd.find('set') != -1: if not self.osp_client.is_valid_command(cmd): raise TefloProvisionerError('There is no command group that supports this command: %s.' % cmd) continue if not self.osp_client.is_valid_command("%s_create" % cmd) \ or not self.osp_client.is_valid_command("%s_delete" % cmd): raise TefloProvisionerError('There is no command group that supports this command: %s.' % cmd) continue # validate teflo plugin schema schema_validator(schema_data=self.build_profile(self.asset), schema_files=[self.__schema_file_path__], schema_ext_files=[self.__schema_ext_path__])
def validate(self): schema_validator(schema_data=self.build_profile(self.asset), schema_files=[self.__schema_file_path__])
def test_schema_validator_no_creds(): params = dict(key1='val1', key2=['val2', 'val3']) schema_validator( schema_data=params, schema_files=[os.path.abspath('../assets/schemas/schema_test.yml')])
def validate(self): """Validate.""" # schema validation for ansible_orchestrate schema schema_validator(schema_data=self.build_profile(self.execute), schema_files=[self.__schema_file_path__], schema_ext_files=[self.__schema_ext_path__])
def validate(self): schema_validator(schema_data=self.build_profile(self.notification), schema_creds=self.creds_params, schema_files=[self.__schema_file_path__])