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

Checkout git repository as user, fixed ensure latest, ssh options #25

Merged
merged 1 commit into from
Jun 29, 2012

Conversation

ejhayes
Copy link

@ejhayes ejhayes commented Jun 29, 2012

Run git operations as a specific user (puppetlabs ticket 4773), added ssh options to ensure no prompting (also fixed in pull request #1 by riseuplabs), added ability to keep repository up to date with latest (puppetlabs ticket 11278).

… ssh options to ensure no prompting (also fixed in pull request puppetlabs#1 by riseuplabs), added ability to keep repository up to date with latest (puppetlabs ticket 11278)
jamtur01 added a commit that referenced this pull request Jun 29, 2012
Checkout git repository as user, fixed ensure latest, ssh options
@jamtur01 jamtur01 merged commit f3acccd into puppetlabs:master Jun 29, 2012
@@ -291,6 +293,8 @@ def git_with_identity(*args)

return ret
end
elsif @resource.value(:user)
su(@resource.value(:user), '-c', "git #{args.join(' ')}" )
Copy link

Choose a reason for hiding this comment

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

I imagine that this will not work on say, Solaris. Possibly BSDs.

sol11% su -h
Usage: su [-] [ username [ arg ... ] ]

Choose a reason for hiding this comment

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

Yeah. Patch ideas?

Copy link

Choose a reason for hiding this comment

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

FreeBSD:

[hal:~]% su -h
su: illegal option -- h
usage: su [-] [-flms] [-c class] [login [args]]

yeah, that will break horribly....

Yes, it needs a patch for sure.

Copy link
Author

Choose a reason for hiding this comment

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

This should be a pretty straightforward fix. I'll see if I can push out an
update to this around lunchtime PST today :-)
On Jun 29, 2012 10:11 AM, "Ben Hughes" <
reply@reply.github.com>
wrote:

@@ -291,6 +293,8 @@ def git_with_identity(*args)

     return ret
   end
  • elsif @resource.value(:user)
  •  su(@resource.value(:user), '-c', "git #{args.join(' ')}" )
    

FreeBSD:

[hal:~]% su -h
su: illegal option -- h
usage: su [-] [-flms] [-c class] [login [args]]

yeah, that will break horribly....

Yes, it needs a patch for sure.


Reply to this email directly or view it on GitHub:
https://github.com/puppetlabs/puppetlabs-vcsrepo/pull/25/files#r1077212

Copy link
Author

Choose a reason for hiding this comment

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

Appears to work for me. What error are you getting?
On Jun 29, 2012 10:13 AM, "Eric Hayes" eric@deployfx.com wrote:

This should be a pretty straightforward fix. I'll see if I can push out an
update to this around lunchtime PST today :-)
On Jun 29, 2012 10:11 AM, "Ben Hughes" <
reply@reply.github.com>
wrote:

@@ -291,6 +293,8 @@ def git_with_identity(*args)

     return ret
   end
  • elsif @resource.value(:user)
  •  su(@resource.value(:user), '-c', "git #{args.join(' ')}" )
    

FreeBSD:

[hal:~]% su -h
su: illegal option -- h
usage: su [-] [-flms] [-c class] [login [args]]

yeah, that will break horribly....

Yes, it needs a patch for sure.


Reply to this email directly or view it on GitHub:
https://github.com/puppetlabs/puppetlabs-vcsrepo/pull/25/files#r1077212

Copy link

Choose a reason for hiding this comment

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

Yeah, FreeBSD does work actually:

[root@hal:/tmp]# su ben -c "git clone git://git.wincent.com/command-t.git"
Cloning into 'command-t'...
remote: Counting objects: 2640, done.
remote: Compressing objects: 100% (964/964), done.
remote: Total 2640 (delta 1445), reused 2613 (delta 1433)
Receiving objects: 100% (2640/2640), 489.04 KiB | 436 KiB/s, done.
Resolving deltas: 100% (1445/1445), done.

And Solaris too. I stand thoroughly corrected (and surprised...). Grand!

@spuriousdata
Copy link

This mostly fixes the ensure => latest problem, but if you don't specify a revision, as I didn't, it still errors:

Could not evaluate: Execution of '/usr/bin/git checkout -b  --track origin/' returned 128: fatal: git checkout:     updating paths is incompatible with switching branches. Did you intend to checkout 'origin/' which can not be resolved as commit?

This can be fixed by specifying revision => 'master', but I think it should probably fall back to 'master' as the default.

bastelfreak pushed a commit to bastelfreak/puppetlabs-vcsrepo that referenced this pull request Apr 23, 2021
fix unsafe default & improve doco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants