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

[MSYS-808] Fix system users issue for windows_task #30

Merged
merged 2 commits into from
May 15, 2018

Conversation

NAshwini
Copy link
Member

Fix the issue of no mapping while creating Windows task for SYSTEM USERS.
As per issue chef/chef#7227

Signed-off-by: NAshwini ashwini.nehate@msystechnologies.com

Signed-off-by: NAshwini <ashwini.nehate@msystechnologies.com>
Signed-off-by: NAshwini <ashwini.nehate@msystechnologies.com>
nil,
nil,
TASK_LOGON_INTERACTIVE_TOKEN
user.empty? ? 'SYSTEM' : user,
Copy link
Contributor

Choose a reason for hiding this comment

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

So, is this the user we're using to create the task, or the user that the task will run as?

Before this change, who would the task run as if a user wasn't passed to the resource but we weren't running as system/localsystem? Would the task run as the current user? We weren't passing a username, but something was still looking up the user as we were getting an error when the system/localsystem user didn't exist. Presumably the WIN32OLE call was doing that look up.

I'm worried that there's a behavior change here beyond just fixing the regression when running as system.

Are we sure that the created task is still running as the same user when we're not passing user/password but we're not running as system?

Is the created task still running in the same way when we do pass a username and password? We were passing nil here before.

Copy link

@Vasu1105 Vasu1105 left a comment

Choose a reason for hiding this comment

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

@btm since user set in new_work_item is nil we were getting that user so we are settling it as SYSTEM when user is not available. We have method call for set_account_information and configure_principals after new_work_item which updates task definition and sets the user based on what is set in recipe so if user is not provided default will be system. And if username and password is used that will be set. And it set author of task and run task as SYSTEM if not provided or whatever provided in recipe.

https://github.com/chef/chef/blob/master/lib/chef/provider/windows_task.rb#L141:L142
https://github.com/chef/chef/blob/master/lib/chef/provider/windows_task.rb#L540:L551

https://github.com/chef/win32-taskscheduler/blob/ole/lib/win32/taskscheduler.rb#L303
https://github.com/chef/win32-taskscheduler/blob/ole/lib/win32/taskscheduler.rb#L1226

@btm btm merged commit 6655813 into chef:ole May 15, 2018
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.

None yet

3 participants