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

'task' and 'connection' objects are poorly documented #933

Closed
shattered opened this issue Feb 8, 2016 · 7 comments
Closed

'task' and 'connection' objects are poorly documented #933

shattered opened this issue Feb 8, 2016 · 7 comments
Labels
docs needed A topic that needs documentation

Comments

@shattered
Copy link

'connection' is at least mentioned in the API doc (http://rexify.org/docs/api/1.3/rex/commands.pm.html#connection) but 'task' is not.

Plus, it appears that task->user is never set, and task->name is not updated when the task has been launched via needs() -- in this case it still reports dependee's name.

@ferki
Copy link
Member

ferki commented Feb 9, 2016

Rex::Task is documented here: http://rexify.org/docs/api/1.3/rex/task.pm.html (updated on 528017a for 1.4rc branch). Maybe that was what you were looking for?

You can take a look at the implementation of connection-releated stuff under Rex::Interface::Connection namespace, but you're right, they are not yet documented. Can you maybe help with adding the bits you missed?

ps.: I'm not sure if the reporting output details when using needs() should belong to this very same issue. Can you open a separate one about that, please? If possible, please include an example with your code, mentioning the wrong results, and the expected ones.

@shattered
Copy link
Author

Ah, indeed Rex::Task is the document I was thinking of. task->user is still empty for me, I'll try to create a test case.

@ferki ferki added the docs needed A topic that needs documentation label Apr 24, 2016
@shattered
Copy link
Author

Turns out that task->user is set unless feature "0.31" or newer is enabled. Why is that?

@krimdomu
Copy link
Contributor

krimdomu commented Jul 9, 2016

@shattered
before 0.31 it was possible to do this:

user "foo";
password "bar";
task "mytask", sub {};  # connect with user: foo

user "otheruser";
password "otherpass";
task "othertask", sub {}; # connect with user: otheruser

This was removed in favour of the auth for => "task" function.

So since since 0.31 the task has a new attribute user. In the time before 0.31 the authentication was not an attribute of the task object.

@shattered
Copy link
Author

Yeah, but why it's reported as empty? :)

@ferki ferki added the Hacktoberfest A topic that is a good candidate for Hacktoberfest participants label Oct 11, 2016
@ferki ferki removed the Hacktoberfest A topic that is a good candidate for Hacktoberfest participants label Nov 9, 2016
@ferki
Copy link
Member

ferki commented Mar 2, 2023

Thanks for you patience, @shattered!

TL;DR:

This issue seems to be a mixture of several smaller questions together, which makes it harder than necessary to process and track properly. Given the combination of

  • the aforementioned mix
  • the age of this question without activity
  • lacking further information to reproduce use cases

I am closing this issue now, with more detailed notes below.

Any readers of this who still have questions or concerns, please reach out on one of our support channels.

Longer version

Nevertheless, let me summarize some notes below.

'connection' objects [...] poorly documented

Right, Rex::Interface::Connection classes still could use some documentation. I would rather deal with that separately, and will open another issue about that single aspect.

'task' objects [...] poorly documented

Docs are available in Rex::Task.

task->user is never set

It's certainly hard to guess a correct answer for a question from years ago without a code example to reproduce the exact same use case that might have been confusing back then.

There were two notable code changes which might have addressed your concern since then:

I'm testing with today's latest version with the following code:

use Rex;
use Rex::TaskList;

task 'test', sub {
    say 1;
};

use DDP;
my $task = Rex::TaskList->create->get_task('test');
p $task->user();

and it returns the expected value (my local username autodetected as a fallback).

task->name is not updated when the task has been launched via needs()

There was no example code attached to help reproduce the same use case, but at first glance it feels possibly "by design" to me. While executing needs() the additional tasks are pulled in as dependencies, and executed on the same connection as if they were a single larger task. This helps with reusability of smaller chunks – but it doesn't imply that there's no bug, or that rex can't do something better.

@ferki
Copy link
Member

ferki commented Mar 2, 2023

(Actually clicking the close button now 🤣 )

@ferki ferki closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs needed A topic that needs documentation
Projects
None yet
Development

No branches or pull requests

3 participants