Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #37 from Temelio/explicit_deployment_key
Browse files Browse the repository at this point in the history
Fix cli authentication problem
  • Loading branch information
achaussier committed Mar 15, 2016
2 parents 7c9d503 + b780a18 commit a684ca2
Show file tree
Hide file tree
Showing 23 changed files with 219 additions and 88 deletions.
9 changes: 7 additions & 2 deletions library/enable_jenkins_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def main():
name=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -32,8 +36,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s %s" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s %s" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
module.params['name']))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/get_jenkins_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def main():

module = AnsibleModule(
argument_spec=dict(
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -26,12 +30,13 @@ def main():

jenkins_cli_path = module.params['cli_path']
jenkins_url = module.params['url']
deployment_ssh_key = module.params['deployment_ssh_key']
script = "%s/%s.groovy" % (module.params['groovy_scripts_path'],
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s" %
(jenkins_cli_path, jenkins_url, script))
"java -jar %s -s '%s' -i '%s' groovy %s" %
(jenkins_cli_path, jenkins_url, deployment_ssh_key, script))

if (rc != 0):
module.fail_json(msg=stderr)
Expand Down
9 changes: 7 additions & 2 deletions library/get_plugin_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def main():
name=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -32,8 +36,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s %s" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s %s" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
module.params['name']))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/install_jenkins_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def main():
name=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -37,8 +41,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s %s %s" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s %s %s" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
module.params['name'], module.params['state']))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def main():
text=dict(
type='str',
required=False),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -70,8 +74,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_location_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def main():
jenkins_url=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -38,8 +42,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s' '%s' '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s' '%s' '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
module.params['full_name'], module.params['email'],
module.params['jenkins_url']))

Expand Down
12 changes: 8 additions & 4 deletions library/manage_jenkins_main_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
slave_agent_port=dict(
type='int',
required=True),

deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -55,9 +58,10 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
json.dumps(module.params)))
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
module.fail_json(msg=stderr)
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_debian_package_builder_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def main():
passphrase=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -44,8 +48,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_debian_package_builder_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def main():
required=False,
default='present',
choice=['present', 'absent']),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -57,8 +61,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_docker_clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def main():
required=False,
default='present',
choice=['present', 'absent']),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -55,8 +59,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def main():
create_accounts=dict(
type='bool',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -38,8 +42,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s' '%s' '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s' '%s' '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
module.params['full_name'], module.params['email'],
module.params['create_accounts']))

Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def main():
type='int',
required=False,
default=20),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -44,8 +48,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def main():
type='bool',
required=False,
default=False),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -39,8 +43,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_hipchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def main():
send_as=dict(
type='str',
required=True),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -46,8 +50,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_hipchat_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def main():
required=False,
choices=['present', 'absent'],
default='present'),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -57,8 +61,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
9 changes: 7 additions & 2 deletions library/manage_jenkins_plugin_mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def main():
type='bool',
required=False,
default=False),
deployment_ssh_key=dict(
type='str',
required=False,
default='/var/lib/jenkins/.ssh/id_rsa'),
cli_path=dict(
type='str',
required=False,
Expand All @@ -57,8 +61,9 @@ def main():
basename(__file__))

rc, stdout, stderr = module.run_command(
"java -jar %s -s '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'], script,
"java -jar %s -s '%s' -i '%s' groovy %s '%s'" %
(module.params['cli_path'], module.params['url'],
module.params['deployment_ssh_key'], script,
json.dumps(module.params)))

if (rc != 0):
Expand Down
Loading

0 comments on commit a684ca2

Please sign in to comment.