Re: Question about the git custom promise type

"'Bas van der Vlies' via help-cfengine" <[email protected]> Thu, 20 Jun 2024 16:35:08 +0200
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
The problem has ben fixed in version 0.2.3
  * https://build.cfengine.com/modules/library-for-promise-types-in-python/

Thanks

On 19/06/2024 13:18, 'Bas van der Vlies' via help-cfengine wrote:
> 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
> 
> On 19/06/2024 12:59, 'Vratislav Podzimek' via help-cfengine wrote:
>> 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 |
>>>
>>
> 

-- 
--
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/f81d2b5d-f9ea-4133-8aaf-2ad6134d7fd7%40surf.nl.
smime.p7s (application/pkcs7-signature, 4.7 KB) - not displayed