# File lib/hammer_cli_import/configfile.rb, line 325
      def build_and_upload
        progress 'Building and uploading puppet modules'
        prod_name = 'Imported Satellite5 Configuration Files'
        @modules.each do |mname, files|
          data = files[0]

          # Build the puppet-module for upload
          module_dir = build_puppet_module(mname)

          # Build/find the product
          product_hash = mk_product_hash(data, prod_name)
          composite_id = [data['org_id'].to_i, prod_name]
          product_id = create_entity(:products, product_hash, composite_id)['id']

          # Build the repo
          repo_hash = mk_repo_hash data, product_id
          # Try creating a repo in the product, skip if it fails
          repo = create_entity(:puppet_repositories, repo_hash,
                               [data['org_id'].to_i, data['channel_id'].to_i])

          # Find the built-module .tar.gz
          built_module_path = File.join(File.join(module_dir, 'pkg'),
                                        "#{mname}-#{@interview_answers['version']}.tar.gz")
          info "Uploading #{built_module_path}"
          # Ask hammer repository upload to Do Its Thing
          rc = system "hammer --username #{api_usr} --password #{api_pwd} " \
                      "repository upload-content --id #{repo['id']} --path #{built_module_path}"

          # If hammer fails us, record it and move on
          if rc
            report_summary :uploaded, :puppet_modules
          else
            report_summary :failed, :puppet_modules
          end
        end
      end