Skip to content

Conversation

@freyes
Copy link
Member

@freyes freyes commented Mar 4, 2025

python-libjuju is released with a tight dependency with the underlying juju version, so when using juju-3.4 , python-libjuju-3.4 is needed, any mismatch will result in failures later.

This patch will still honor the semantic of TEST_JUJU3.

@freyes freyes requested a review from hemanthnakkina March 4, 2025 19:16
@freyes freyes marked this pull request as draft March 4, 2025 19:16
@freyes
Copy link
Member Author

freyes commented Mar 4, 2025

@hemanthnakkina , what do you think about this patch?, it's basically setting the python-libjuju dependency dynamically based on the juju client version available in the system.

if int(version[0]) >= 3:
juju_ver_n = version[0:3]
juju_ver_n1 = "%s.%s" % (version[0], int(version[2]) + 1)
install_require.append('juju>=%s,<%s' % (juju_ver_n,
Copy link
Contributor

Choose a reason for hiding this comment

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

I am sceptical about using juju>=juju_ver_n especially for cases of any new juju major series release (using terminology mentioned in [1]) like 3.x -> 3.y or 4.x -> 4,y
Since there is usually couple of days gap between Juju release and py-libjuju release.
Here is the past data for 3.6 release for juju and pylibjuju [2] [3]

We need to check with juju team if they really follows what they mentioned in documentation [1] to use juju>=version[0],<juju_ver_n1

[1] https://canonical-juju.readthedocs-hosted.com/en/latest/user/reference/juju/juju-cross-version-compatibility/#juju-cli-controllers-and-ref-agents
[2] https://github.com/juju/juju/releases/tag/v3.6.0
[3] https://github.com/juju/python-libjuju/releases/tag/3.6.0.0

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd expect libjuju to significantly lag behind juju for new major versions. But then, running e.g. libjuju 3.x with juju 4.x is likely to run into compatibility issues, so I'm thinking failing the run for major version mismatches might be a good decision anyway.

Wonder if the version parsing should be made more robust to better handle version string format changes or double-digit versions though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed a new revision of that patch with a more reasonable parsing.

@freyes freyes requested review from gboutry, sabaini and wolsen March 5, 2025 16:19
@freyes
Copy link
Member Author

freyes commented Mar 5, 2025 via email

@freyes freyes marked this pull request as ready for review March 5, 2025 21:01
universal_newlines=True).strip()
print('juju --version ->', version)
if int(version[0]) >= 3:
(major, minor) = version.split('.')[0:2]
Copy link
Contributor

Choose a reason for hiding this comment

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

This will fail whenever minor version cropped into double digit like 4.10

(major, minor, *_) = version.split('.')
juju_ver_n = "%s.%s" % (major, minor)
juju_ver_n1 = "%s.%s" % (major, int(minor) + 1)

Copy link
Member Author

@freyes freyes Mar 6, 2025

Choose a reason for hiding this comment

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

I don't think that will make that piece of code fail:

>>> version = "4.10.6-genericlinux-amd64"
>>> (major, minor) = version.split('.')[0:2]
>>> major
'4'
>>> minor
'10'

I did fix this line though -> https://github.com/openstack-charmers/zaza/compare/56c4edb7dee667ed7169f2ae4ed5688ec59afb4f..cb31096758c3f56aac13b06dafe93b3e942cd949

Copy link
Contributor

Choose a reason for hiding this comment

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

AAh such a silly mistake from me, you are right

Copy link
Contributor

Choose a reason for hiding this comment

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

missing '' for . in the new change

python-libjuju is released with a tight dependency with the underlying
juju version, so when using juju-3.4 , python-libjuju-3.4 is needed, any
mismatch will result in failures later.

This patch will still honor the semantic of TEST_JUJU3.
universal_newlines=True).strip()
print('juju --version ->', version)
if int(version[0]) >= 3:
(major, minor) = version.split('.')[0:2]
Copy link
Contributor

Choose a reason for hiding this comment

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

AAh such a silly mistake from me, you are right

universal_newlines=True).strip()
print('juju --version ->', version)
if int(version[0]) >= 3:
(major, minor) = version.split('.')[0:2]
Copy link
Contributor

Choose a reason for hiding this comment

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

missing '' for . in the new change

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.

3 participants