Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8952: Add generic methods using new package promises #427

Conversation

amousset
Copy link
Member

@amousset amousset commented Sep 6, 2016

@amousset
Copy link
Member Author

amousset commented Sep 6, 2016

WIP

# ```
# methods:
# "any" usebundle => package_present("postgresql", "9.1", "x86_64", "enforce");
# "any" usebundle => package_present("postgresql", "lastest", "default", "enforce");
Copy link
Member

Choose a reason for hiding this comment

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

s/lastest/latest/

@amousset
Copy link
Member Author

amousset commented Sep 7, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from e9b37ca to 3689453 Compare September 7, 2016 09:23
@amousset
Copy link
Member Author

amousset commented Sep 7, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 3689453 to 512289a Compare September 7, 2016 13:32

debian.architecure_specified.version_specified::
"${name}"
policy => "present",
Copy link
Member

Choose a reason for hiding this comment

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

could you align the => , please ?
Thank you !

@amousset
Copy link
Member Author

amousset commented Sep 7, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 512289a to 0005020 Compare September 7, 2016 16:20

}

body package_module apt_get
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this body be in the ncf_lib?
Plus it seem it doesn't do anything on redhat like system (nor suse)

Copy link
Member Author

Choose a reason for hiding this comment

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

It is still a WIP, I will add Red Hat support after. The body is there for convenience, it will be moved in a "3.7 ncf_lib" after.

@amousset
Copy link
Member Author

amousset commented Sep 8, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 0005020 to 125acc6 Compare September 8, 2016 09:58
@amousset
Copy link
Member Author

amousset commented Sep 8, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 125acc6 to 78c0504 Compare September 8, 2016 14:18
@amousset
Copy link
Member Author

amousset commented Sep 8, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 78c0504 to 68d6d68 Compare September 8, 2016 14:20

vars:
"canonified_name" string => canonify("${name}");
"old_class_prefix" string => "package_present_${canonified_name}";
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it be package_absent ?

@amousset
Copy link
Member Author

amousset commented Sep 9, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 68d6d68 to 4d74f0d Compare September 9, 2016 10:29
@amousset
Copy link
Member Author

amousset commented Sep 9, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 4d74f0d to d6dc5a2 Compare September 9, 2016 13:11
body package_module yum
{
# Query package updates only every 24 hours.
query_updates_ifelapsed => "1440";
Copy link
Member Author

Choose a reason for hiding this comment

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

@ncharles How do do you think we should make this configurable?

Copy link
Member

Choose a reason for hiding this comment

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

i can make a dumb answer: add parameters in the body
a more clever answer would be to have logical default, and be able to define them globally (it doesn't make sense to have different values for different package on a given node). So it may be a generic method "configure package update frequency" that would define it through a bundle common something.
What do you think of it ?

@amousset
Copy link
Member Author

amousset commented Sep 9, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from d6dc5a2 to fb9f99b Compare September 9, 2016 15:33
@amousset
Copy link
Member Author

amousset commented Sep 9, 2016

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from fb9f99b to 855e3dd Compare September 9, 2016 15:54
@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 855e3dd to 738ec96 Compare September 12, 2016 09:01
@jooooooon
Copy link
Member

It's time to implement drop-down / multiple selection lists in ncf builder :) cc @VinceMacBuche @RaphaelGauthier

@jooooooon
Copy link
Member

OK, thanks, Alexis. I'll ask @aanriot to test then.

@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch 2 times, most recently from baf570f to c0a0305 Compare September 15, 2016 14:36
@amousset
Copy link
Member Author

  • Fixed a typo that broke specified architectures
  • Improved the test.

@amousset
Copy link
Member Author

We still have two open questions:

Distributing the modules

Normation/rudder-techniques#1029.

Configuring the modules

Each module needs a body like:

body package_module apt_get
{
    # Query list of installed packages from package manager
    query_installed_ifelapsed => "60";
    # Query list of available updates from package manager
    query_updates_ifelapsed => "1440";
}

We should probably have default values and can make them overridable:

  • With a specific call/generic method
  • Using ncf.conf

I think I prefer the second, as it is really a global configuration parameter and not a part of any policy (like execution frequency for example).
Ideally, It would be great to have a setting in Rudder to set this parameter by node/group/global.

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from c0a0305 to 9092690 Compare September 16, 2016 09:43
@amousset
Copy link
Member Author

  • Added the body for the test module to package_lib.cf as it is now in the _package_state bundle.

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 9092690 to e16124d Compare September 21, 2016 15:52
@amousset
Copy link
Member Author

Added a zypper module based on the yum module. Commands and options are adapted, but the logic from parsing zypper output is not there yet.

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from e16124d to b345837 Compare September 21, 2016 16:39
@amousset
Copy link
Member Author

Added parsing for the list of available updates. We still need:

  • Build package arguments (probably not very different, still not tested)
  • Handle installation from repositories, a bit more test needed for update/install handling

@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from b345837 to fb551ca Compare September 23, 2016 14:44
Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

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

This is one impressive piece of work - i do have some questions (as comments in the PR)

@@ -0,0 +1,57 @@
bundle common acc_path
Copy link
Member

Choose a reason for hiding this comment

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

You are missing the header of the file

@@ -0,0 +1,361 @@
#!/usr/bin/python
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we mention somewhere that it comes from the CFEngine repository ?

@@ -0,0 +1,408 @@
#!/usr/bin/python
Copy link
Member

Choose a reason for hiding this comment

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

same here

@@ -0,0 +1,394 @@
#!/usr/bin/python
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we add our header ?

"architecture_specified" not => strcmp("default", "${architecture}");

# Select the right package manager
# Always use the specified one, and select a default based on the OS
Copy link
Member

Choose a reason for hiding this comment

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

i don't understand how the default one would be selected

Copy link
Member Author

Choose a reason for hiding this comment

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

because of the "provider" string => "${package_module_knowledge.platform_default}", if_match_regex => "default"; above.

Copy link
Member Author

Choose a reason for hiding this comment

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

But this comment should be moved.

Copy link
Member

Choose a reason for hiding this comment

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

thanks

@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from fb551ca to dab2c0a Compare September 26, 2016 12:08
"architecture" string => "default", if_match_regex => "";
"provider" string => "default", if_match_regex => "";
# Select the default packager for this platform if "default"
"provider" string => "${package_module_knowledge.platform_default}", if_match_regex => "default";
Copy link
Member

Choose a reason for hiding this comment

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

can you chain the default (does it work as expected ?)

@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from dab2c0a to 1a04fab Compare September 26, 2016 12:37
@amousset
Copy link
Member Author

Commit modified

@amousset amousset force-pushed the ust_8952/add_generic_methods_using_new_package_promises branch from 1a04fab to 7fb553c Compare September 26, 2016 12:51
Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

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

This is great !

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/ncf/pull/427
-- Your faithful QA

@amousset
Copy link
Member Author

OK, merging this PR

@amousset amousset merged commit 7fb553c into Normation:master Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants