Project

General

Profile

Actions

Bug #19386

closed

Cannot export templates to a new branch on github

Added by Ondřej Pražák almost 7 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When exporting to github, templates can only be exported to a branch that already exists. When you create a new repo, you have to at least add licence so that master branch is created and then you can export to master.
Steps to reproduce:

1) create new repo on gihub, add licence
2) run the following command and observe the error:

[root@foreman tmp]# foreman-rake templates:export repo=ssh://git@github.com/myprofile/template_export.git branch=nonexisting
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
/opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.2/app/services/redhat_access/telemetry/look_ups.rb:170: warning: key :hosts is duplicated and overwritten on line 171
rake aborted!
Git::GitExecuteError: git reset "--hard" "origin/nonexisting"  2>&1:fatal: ambiguous argument 'origin/nonexisting': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/opt/theforeman/tfm/root/usr/share/gems/gems/git-1.2.5/lib/git/lib.rb:700:in `command'
/opt/theforeman/tfm/root/usr/share/gems/gems/git-1.2.5/lib/git/lib.rb:430:in `reset'
/opt/theforeman/tfm/root/usr/share/gems/gems/git-1.2.5/lib/git/base.rb:264:in `reset_hard'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_templates-4.0.1/app/services/foreman_templates/template_exporter.rb:36:in `export_to_git'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_templates-4.0.1/app/services/foreman_templates/template_exporter.rb:9:in `export!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_templates-4.0.1/lib/tasks/foreman_templates_tasks.rake:43:in `block (2 levels) in <top (required)>'
Tasks: TOP => templates:export
(See full trace by running task with --trace)

3) run foreman-rake templates:export repo=ssh:/myprofile/template_export.git branch=master
4) export finished successfully

When I try to push to a new branch, I would expect a branch to be created, or at least get a meaningful error message if pushing to new branches is not meant to be supported.

Actions #1

Updated by Ondřej Pražák almost 6 years ago

  • Status changed from New to Resolved
  • Triaged set to No

This is no longer an issue, templates seem to export to new branches correctly. I will reopen if I run into it again.

Actions

Also available in: Atom PDF