Re: Question about the git custom promise type

"'Bas van der Vlies' via help-cfengine" <[email protected]> Mon, 17 Jun 2024 17:23:37 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
https://github.com/cfengine/modules/pull/97

On 17/06/2024 17:16, 'Bas van der Vlies' via help-cfengine wrote:
> OK found the error `--abbrev-re` must be `--abbrev-ref`. Will submit a 
> pull request
> 
> 
> 
> On 17/06/2024 14:26, 'Bas van der Vlies' via help-cfengine wrote:
>> I have installed the git promise type from:
>>   * https://build.cfengine.com/modules/promise-type-git/0.2.3/
>>
>> This is a very simple example but I get an error when run in 
>> non-inform mode:
>> ```
>>      git:
>>
>>          "cf_data_repo"
>>
>>              repository => "git@<server>:clustercomputing/cf_data",
>>
>>              destination => "$(git_data_dir)",
>>
>>              version => "master",
>>
>>              force => "true",
>>
>>              ssh_options =>  "-i /root/.ssh/id_ed25519 -o 
>> IdentitiesOnly=yes",
>>              update => "true
>> ```
>>
>> This is good when we run with the -I flag:
>>   * cf-agent -IK -f ./update.cf
>> ```
>> 14:17 install3.cc.surfsara.nl:~/bas/cf_masterfiles/working (master)
>> root# cf-agent -KI -f ./update.cf
>>      info: Checkout 'git@<server>:clustercomputing/cf_data:master' in 
>> '/data/cfengine3'
>> ```
>>
>> And with this one:
>>   * 14:17 install3.cc.surfsara.nl:~/bas/cf_masterfiles/working (master)
>> root# cf-agent -K f ./update.cf
>>
>> ```
>> CRITICAL: Bug in promise module - Failed to log about changes made by 
>> a repaired git promise with promiser 'cf_data_repo' 
>> (/root/bas/cf_masterfiles/working/./lib/update/bundle.cf:65)
>> ```
>>
>> This is due to the fact in the `git.py`:
>> ```
>>                      if output == "HEAD":
>>
>>                          detached = True
>>
>>                          output = self._git(
>>
>>                              model,
>>
>>                              [model.executable, "rev-parse", "HEAD"],
>>
>>                              cwd=model.destination,
>>
>>                          )
>>
>>                      if output != model.version:
>>
>>                          self.log_info(
>>
>>                              "Checkout '{repository}:{version}' in 
>> '{destination}'".format(
>>                                  repository=model.repository,
>>
>>                                  version=model.version,
>>
>>                                  destination=model.destination,
>>
>>                              )
>>
>>                          )
>>
>>                          self._git(
>>
>>                              model,
>>
>>                              [model.executable, "checkout", 
>> model.version],
>>                              cwd=model.destination,
>>
>>                          )
>>
>>                          result = Result.REPAIRED
>> ```
>>
>> the `result line is the cause of the problem. The problem that I want 
>> to update the `master` branch and the `ouput` is compared against a 
>> branch name:
>> ```
>>   verbose: Run: git rev-parse --abbrev-re HEAD
>>     debug: Received line from module: 
>> 'log_verbose=--abbrev-re\nca3df8de2987a4b2a2e49768de9c7f9fe53349b3'
>>   verbose: --abbrev-re\nca3df8de2987a4b2a2e49768de9c7f9fe53349b3
>> ```
>>
>> That is not equal branch name `master`. Is the a bug or did I 
>> something wrong?
>>
>>
>>
> 

-- 
--
Bas van der Vlies
| High Performance Computing & Visualization | SURF| Science Park 140 | 
1098 XG  Amsterdam
| T +31 (0) 20 800 1300  | [email protected] | www.surf.nl |

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/912da5f9-2a45-4350-9ebf-213c3fe527f7%40surf.nl.
smime.p7s (application/pkcs7-signature, 4.7 KB) - not displayed