Skip to content

Remove invalid config_install_interval - #8769

Merged
memsharded merged 2 commits into
conan-io:developfrom
uilianries:hotfix/config-install-interval
Apr 8, 2021
Merged

memsharded merged 2 commits into
conan-io:developfrom
uilianries:hotfix/config-install-interval

Conversation

@uilianries

@uilianries uilianries commented Apr 6, 2021

Copy link
Copy Markdown
Member

Hello there.

I've added new units for seconds and weeks. Now when loading conan.conf, if config_install_interval is invalid, it will be removed.

I did another change that may break users, but I think necessary. Before this PR, if config_install_interval value had no value (e.g. config_install_interval=1), it would be considered days, implicitly. Now, an unit is mandatory (explicit is better than implicit).

I need to update docs, because those units are not clear there, but first I would like some review.

fixes #8713

Changelog: Fix: config_install_interval no longer enter in loop when invalid.
Docs: conan-io/docs#2067

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
self.assertIn("ERROR: Incorrect definition of general.config_install_interval: {}. "
"Removing it from conan.conf to avoid possible loop error.".format(internal),
self.client.out)
self.client.run('install .')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once removed, no error should occur, as we have default conanfile.txt to be installed.

Comment thread conans/util/dates.py Outdated
elif unit == 'h':
return datetime.timedelta(hours=float(value))
else:
elif unit == 'd':

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be a breaking change. Default was days, now we no longer accept implicit values. I don't think it's a good idea keeping implicit support, we would need read docs to understand what's the behavior.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the docs:

The config_install_interval variable starts a time scheduler which runs conan config install according the time interval configured. It only accepts the follow time intervals: minutes, hours and days.

It is lacking some details. It should also have been labeled as experimental, this could be a problem, I'd probably keep the default with a big warning.

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just some concern about breaking, it is indeed likely that this will break, so probably keep old default "days".

Comment thread conans/util/dates.py Outdated
elif unit == 'h':
return datetime.timedelta(hours=float(value))
else:
elif unit == 'd':

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the docs:

The config_install_interval variable starts a time scheduler which runs conan config install according the time interval configured. It only accepts the follow time intervals: minutes, hours and days.

It is lacking some details. It should also have been labeled as experimental, this could be a problem, I'd probably keep the default with a big warning.

@memsharded memsharded added this to the 1.36 milestone Apr 7, 2021
@uilianries

Copy link
Copy Markdown
Member Author

Looking good, just some concern about breaking, it is indeed likely that this will break, so probably keep old default "days".

Checking again, it was an impossible condition. At line 34 has a regex which only accepts values with units. I just reverted conans/util/dates.py and executed new tests, which tries to validate with no unit and it failed as expected.

Comment thread conans/util/dates.py
Comment thread conans/util/dates.py Outdated
elif unit == 'd':
return datetime.timedelta(days=float(value))
elif unit == 'w':
return datetime.timedelta(weeks=float(value))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no else branch in order unit isn't any of s/m/h/d/w

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really necessary if the previous regex guarantees unit is always defined. But yes, probably the dictionary is a bit neater.

@memsharded

Copy link
Copy Markdown
Member

Checking again, it was an impossible condition. At line 34 has a regex which only accepts values with units. I just reverted conans/util/dates.py and executed new tests, which tries to validate with no unit and it failed as expected.

You are right, good!

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@memsharded
memsharded merged commit 7412359 into conan-io:develop Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] ERROR: Incorrect definition of general.config_install_interval: 1s

3 participants