foreman_templates 7.0.5 → 7.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 773f26f24c7e56569b70ae180164487a804c89a6
4
- data.tar.gz: 13138a1fd87a675c222333e57e7c2ea78a1489c0
2
+ SHA256:
3
+ metadata.gz: 40c303f1207307e582859933360b3e2e9b2deb5793ff7816bf2fe2ccdd17b678
4
+ data.tar.gz: e25c5b35b84061c38f7051097e5c184a5369a1ba18974c40ae137e9828da3617
5
5
  SHA512:
6
- metadata.gz: eecbb9e4993ab19b071dfa052290e45b9ee14d50e62b99984de31ea8f28a3a9c48b19bbc06ce17ccab1fdccd325e8016dbc2e1ea7d1a5c13c9520fbd096498d0
7
- data.tar.gz: c2091508b18ecb0396564782b809e0e9e69c1489389a0cee5397c7c9a39dab1c2e46954486efd75de2f41b41a01090d8b0db03984b60dc392edf923c9d41b9fc
6
+ metadata.gz: 78989629db36f53ca6aa96c396c3d32c02ed5176c3cf5026ccafb4ddc06aae85538ae8d68cdcd443bd9c8d8355c7bee507115606d7d9077d9c6d853052204286
7
+ data.tar.gz: 5ff10abf7e6c88946d008a17f6afe9fd8e5880b141d6b7ac9f833c2e789d40a42b03043aabc8024c02c473e18eb79fbaf0bde2dfd4d31c8adfee9d399dc7222c
@@ -14,6 +14,7 @@ module ForemanTemplates
14
14
  :changed => changed?,
15
15
  :imported => @imported,
16
16
  :additional_errors => @additional_errors,
17
+ :additional_info => @additional_info,
17
18
  :exception => @exception ? @exception.message : nil,
18
19
  :validation_errors => errors.to_h,
19
20
  :file => @template_file,
@@ -33,8 +33,13 @@ module ForemanTemplates
33
33
  dump_files!
34
34
  git_repo.add
35
35
 
36
- status = git_repo.status
37
- if status.added.any? || status.changed.any? || status.deleted.any? || status.untracked.any?
36
+ new_repo = false
37
+ begin
38
+ status = git_repo.status
39
+ rescue Git::GitExecuteError # no HEAD for repo without commits, git diff-index HEAD fails
40
+ new_repo = true
41
+ end
42
+ if new_repo || status.added.any? || status.changed.any? || status.deleted.any? || status.untracked.any?
38
43
  git_repo.commit "Templates export made by Foreman user #{foreman_git_user}"
39
44
  git_repo.push 'origin', branch
40
45
  @export_result.exported = true
@@ -50,13 +55,13 @@ module ForemanTemplates
50
55
 
51
56
  def setup_git_branch(git_repo)
52
57
  logger.debug "checking out branch '#{@branch}'"
53
- if git_repo.is_branch?(@branch)
58
+ if git_repo.is_branch?(@branch) # local branch
54
59
  git_repo.checkout(@branch)
55
- else
60
+ elsif git_repo.is_remote_branch?(@branch) # if we work with remote branch, checkout and sync
56
61
  git_repo.branch(@branch).checkout
57
- if git_repo.is_remote_branch?(@branch) # if we work with remote branch we need to sync it first
58
- git_repo.reset_hard("origin/#{@branch}")
59
- end
62
+ git_repo.reset_hard("origin/#{@branch}")
63
+ else # neither local nor remote
64
+ git_repo.checkout(@branch, :new_branch => true)
60
65
  end
61
66
  end
62
67
 
@@ -1,3 +1,3 @@
1
1
  module ForemanTemplates
2
- VERSION = '7.0.5'.freeze
2
+ VERSION = '7.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.5
4
+ version: 7.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sutcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  version: '0'
199
199
  requirements: []
200
200
  rubyforge_project:
201
- rubygems_version: 2.6.14
201
+ rubygems_version: 2.7.6.2
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Template-syncing engine for Foreman