Question about the git custom promise type

12 views
Skip to first unread message

Bas van der Vlies

unread,
Jun 17, 2024, 8:26:32 AMJun 17
to help-cfengine
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 | bas.van...@surf.nl | www.surf.nl |

Bas van der Vlies

unread,
Jun 17, 2024, 11:16:10 AMJun 17
to help-c...@googlegroups.com
OK found the error `--abbrev-re` must be `--abbrev-ref`. Will submit a
pull request

Bas van der Vlies

unread,
Jun 17, 2024, 11:23:46 AMJun 17
to help-c...@googlegroups.com

Vratislav Podzimek

unread,
Jun 17, 2024, 11:32:01 AMJun 17
to help-c...@googlegroups.com
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

signature.asc

Bas van der Vlies

unread,
Jun 19, 2024, 5:34:21 AMJun 19
to help-c...@googlegroups.com
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

Vratislav Podzimek

unread,
Jun 19, 2024, 6:59:31 AMJun 19
to help-c...@googlegroups.com
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.
signature.asc

Bas van der Vlies

unread,
Jun 19, 2024, 7:18:33 AMJun 19
to help-c...@googlegroups.com
Yes, I had the same experience. Also used -I and then put in production
and this messages appeared ;-). That is why I investigated the problem.

Thanks

Bas van der Vlies

unread,
Jun 20, 2024, 10:35:18 AM (14 days ago) Jun 20
to help-c...@googlegroups.com
The problem has ben fixed in version 0.2.3
* https://build.cfengine.com/modules/library-for-promise-types-in-python/

Thanks

Vratislav Podzimek

unread,
Jun 20, 2024, 10:48:23 AM (14 days ago) Jun 20
to help-c...@googlegroups.com
On Thu, 2024-06-20 at 16:35 +0200, 'Bas van der Vlies' via help-cfengine wrote:
> The problem has ben fixed in version 0.2.3
> * https://build.cfengine.com/modules/library-for-promise-types-in-python/
>
> Thanks
Thanks for testing, Bas!

--
Vratislav

signature.asc
Reply all
Reply to author
Forward
0 new messages