Re: Question about the git custom promise type

"'Vratislav Podzimek' via help-cfengine" <[email protected]> Wed, 19 Jun 2024 12:59:24 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
On Wed, 2024-06-19 at 11:34 +0200, 'Bas van der Vlies' via help-cfengine wrote:
> I have found another issue with custom promise types and logging. That 
> cause that a info message is translated to a CRITICAL cfengine bug. I am 
> not interested in the info messages. See for details:
>   * https://northerntech.atlassian.net/browse/CFE-4406
Thanks for the ticket, Bas! I'll try to fix this ASAP, it's definitely an
annoying thing. However, it was easy to miss because `--inform` is usually the
key when developing and debugging things.

--
Vratislav


> 
> On 17/06/2024 17:31, 'Vratislav Podzimek' via help-cfengine wrote:
> > 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 |
> > > 
> > 
> 
> -- 
> --
> 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/c0c1ceef153273d84c83403db9512cd39df096a3.camel%40northern.tech.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEENAH7ns+FyuCe6j1XmyV2peQQR/QFAmZyugwACgkQmyV2peQQ
R/TQChAAoZmSUGwcZjpiZ/9pKJcQKSQy4sJ4Jlc/187/SRlP9xviMtKcb1tL/Xta
MNAc5YOLpTIDPBY/ZTy1gu6mGtqZ4pb7zx2LHIUaMk8l807IK87Pv7YdpqafHW3t
/g5/W1CuhmRDZbaIpp/58BcTSMDtUT3fXRzbEsgIP6UWtRrNjIJc5AtFYse20rQS
KlpNEn8xQv1eIKCA1mQzKZblxh4v/Lz+8UR6KGYdq92/Cp4FvdnIC5r/Akk6cjQH
IEMaZZofUZzd9IL/6tTiALHgCv65QAYrCDaQKRoKQ8E3ECLCLqn7Zd72bsJVbZ9I
lRaxFbKloEUbmJ9a8qLHj9nThZrQF4AuSDrcza52+lRHvK+1HEh5rRAQH/RBvMMs
MJwCeEVXZoA/nTTlkvhgBnYzuxe0/19pRsH3sEmJ7zNZ58Kv7HTYf7OF3cyLZVVL
7ZtKMcZ74hfNX5/X1p6BjlgqE00I1LpId1jBRdHfh2/LrTgdxW7q1EpX5LCbjWJw
3Doe96DzDbrmYWpnv530VZi0l20XtQB+AlrK3kcDEAr9WYixOtfn7EUCT42igshN
uM056vAKgNBrqb5VMWMFjVDqaBIPkSPFwG+nrOWu1rFaR/V8EZFy51hN9gLps2fV
OJ80aKGP//FzBSUmy/F+rgCn23XU/I/fSQRfr0pVyvQf/tw4oP8=
=uKZG
-----END PGP SIGNATURE-----