Re: Question about the git custom promise type

"'Vratislav Podzimek' via help-cfengine" <[email protected]> Mon, 17 Jun 2024 17:31:55 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
On Mon, 2024-06-17 at 17:23 +0200, 'Bas van der Vlies' via help-cfengine wrote:
> https://github.com/cfengine/modules/pull/97
Thanks, Bas!

--
Vratislav

> 
> 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/57355a306c52d4735ca978a2b7c2bd6ab12ca009.camel%40northern.tech.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEENAH7ns+FyuCe6j1XmyV2peQQR/QFAmZwVusACgkQmyV2peQQ
R/TUyA//ezkcs6UHChdCKF1ZdSH2p8B3iPMhC8hao5S9w9Zhqm30TU75ukP1l8eB
xjLxqenrgjkjs5WdEsj3EAqPik/7bb4ycW+JZOitpPS9I+cfYbx6vmKeVXNCjGSw
reiQSW2cl7nITQT9fZow3JExcaQTzZ+4bwbRsOHXYbh8LeQzX++eGMUb/aOadJg7
byUbSwgEeXl/qCtNOdK5IVc+5xEekK4jDYRQTBW01IZMVEAHPH3lyuEiKmdCmpTW
y81/EbZdZshbrrYcuqlK5CHlsPDTXJ2sReY+Ez5OBPRly9DU+gByLiHPBSP1dVDc
5vN38OF6XsH2g2wTgioQlXkN+HJTy6U2ubLMFkuaWxZL390eubOqNUgbhP/ZbEoE
ZZYVO+vwhJFDQBqw6KIuTvKTTdYzowgWzgOMVALJj3xVH5PW2BZNq7rFCYwjW89J
S639c30k8KwkYX5NFB22ArhXP31+wDlCkz1SNLXZHv5wlZtZNiAiUU89N4omdNKk
285KWfOMlolUr4btaJNl4VbRQ1vCHrvgmTYcWqujtGnY93UfJMsT6kxwO6lroQ9+
Jm/0HQ+Kwwb7IvlDpa+tw4Fd5S/VTOg/pDRYeljapRN6msB/56XDW0cHKIOKwygg
qOnfxT/XCNq7t3F6WSmOWOiDCJYbijDOq6JOuV/k5yvxASSDaQc=
=M8IQ
-----END PGP SIGNATURE-----