예제 #1
0
 def find_system(cb_path):
     """
     Discovers cookbook format from a given path
     :param cb_path: path to the cookbook
     :return: system type
     """
     system = None
     if puppet_client.check_puppet_module(cb_path):
         system = "puppet"
     elif chef_client.check_chef_cookbook(cb_path):
         system = "chef"
     elif murano_client.check_murano_blueprint(cb_path):
         system = "murano"
     return system
예제 #2
0
 def upload_coobook(self, path):
     """
     Uploads a validated cookbook to the official Github repo
     Authentication must be enabled via external shared keys
     :param path: cookbook path
     :return: status message
     """
     dest_url = None
     if chef_client.check_chef_cookbook(path):
         dest_url = CONF.clients_chef.github_url
     elif puppet_client.check_puppet_module(path):
         dest_url = CONF.clients_puppet.github_url
     elif murano_client.check_murano_blueprint(path):
         dest_url = CONF.clients_murano.github_url
     if dest_url:
         LOG.info("Pushing cookbook to %s" % dest_url)
         dest = self.repo.create_remote(self.user, dest_url)
         self.repo.create_head('remote', dest.refs.master).set_tracking_branch(dest.refs.master)
         message = dest.push()
     else:
         LOG.warning("Error detecting cookbook type for %s" % path)
         message = "Error"
     return message