Repository: ansible/ansible-modules-core

Issue:
Universal Package - "use"
The docs for the new `package` module mention a `use` argument to explicitly say which provider to use. Can this be arbitrary? For example, I use a module for Archlinux's `packer` utility for accessing the AUR. Could I use `use=packer` assuming the third party module is "compatible" in some way?

Also, I looked at the source for package.py and it was 100% docstring. What's up with that?



Discussion:
# List Information

Hi!

Thanks very much for your interest in Ansible.  It sincerely means a lot to us. 

This appears to be a user question, and we'd like to direct these kinds of things to either the mailing list or the IRC channel.
- IRC: #ansible on irc.freenode.net  
- mailing list: https://groups.google.com/forum/#!forum/ansible-project

If you can stop by there, we'd appreciate it.  This allows us to keep the issue tracker for bugs, pull requests, RFEs and the like.

Thank you once again and we look forward to seeing you on the list or IRC.  Thanks!


Resolving patch:
diff --git a/packaging/os/redhat_subscription.py b/packaging/os/redhat_subscription.py
--- a/packaging/os/redhat_subscription.py
+++ b/packaging/os/redhat_subscription.py
@@ -98,6 +98,12 @@
         required: False
         default: null
         version_added: "2.1"
+    force_register:
+        description:
+            -  Register the system even if it is already registered
+        required: False
+        default: False
+        version_added: "2.2"
 '''
 
 EXAMPLES = '''
@@ -247,7 +253,7 @@ def is_registered(self):
             return False
 
     def register(self, username, password, autosubscribe, activationkey, org_id,
-                 consumer_type, consumer_name, consumer_id):
+                 consumer_type, consumer_name, consumer_id, force_register):
         '''
             Register the current system to the provided RHN server
             Raises:
@@ -273,6 +279,8 @@ def register(self, username, password, autosubscribe, activationkey, org_id,
                 args.extend(['--name', consumer_name])
             if consumer_id:
                 args.extend(['--consumerid', consumer_id])
+            if force_register:
+                args.extend(['--force'])
 
         rc, stderr, stdout = self.module.run_command(args, check_rc=True)
 
@@ -443,6 +451,7 @@ def main():
                     consumer_type = dict(default=None, required=False),
                     consumer_name = dict(default=None, required=False),
                     consumer_id = dict(default=None, required=False),
+                    force_register = dict(default=False, type='bool'),
                 )
             )
 
@@ -460,6 +469,7 @@ def main():
     consumer_type = module.params["consumer_type"]
     consumer_name = module.params["consumer_name"]
     consumer_id = module.params["consumer_id"]
+    force_register = module.params["force_register"]
 
     # Ensure system is registered
     if state == 'present':
@@ -471,7 +481,7 @@ def main():
             module.fail_json(msg="Missing arguments, If registering without an activationkey, must supply username or password")
 
         # Register system
-        if rhn.is_registered:
+        if rhn.is_registered and not force_register:
             if pool != '^$':
                 try:
                     result = rhn.update_subscriptions(pool)
@@ -487,7 +497,7 @@ def main():
                 rhn.enable()
                 rhn.configure(**module.params)
                 rhn.register(username, password, autosubscribe, activationkey, org_id,
-                             consumer_type, consumer_name, consumer_id)
+                             consumer_type, consumer_name, consumer_id, force_register)
                 subscribed_pool_ids = rhn.subscribe(pool)
             except Exception:
                 e = get_exception()


Test patch: